From 01625ed1baef70c23499124afe090642665a6157 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 1 Oct 2014 14:02:40 +0100 Subject: Improve InfoRequest.find_in_state SQL --- app/models/info_request.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/models/info_request.rb') diff --git a/app/models/info_request.rb b/app/models/info_request.rb index d0052603a..74c245e56 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -1345,9 +1345,9 @@ public end def InfoRequest.find_in_state(state) - find(:all, :select => '*, ' + last_event_time_clause + ' as last_event_time', - :conditions => ["described_state = ?", state], - :order => "last_event_time") + select("*, #{ last_event_time_clause } as last_event_time"). + where(:described_state => state). + order('last_event_time') end private -- cgit v1.2.3