aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2015-04-21 16:07:35 +0100
committerGareth Rees <gareth@mysociety.org>2015-04-27 16:17:11 +0100
commitb62d81b80016c9046e19fb10e28c07a5514b3095 (patch)
tree7a0336f4f6bcb14b6dd0959105772b72e1d38076 /app/models/info_request.rb
parent578a658bd1988ec23bfb5f3c2cc173bab20d76ba (diff)
Only load the outgoing messages that will be used
Prevents loading of all outgoing messages related to the info request. Before OutgoingMessage Load (1.5ms) SELECT "outgoing_messages".* FROM "outgoing_messages" WHERE "outgoing_messages"."info_request_id" = 137 ORDER BY created_at After OutgoingMessage Load (0.8ms) SELECT "outgoing_messages".* FROM "outgoing_messages" WHERE "outgoing_messages"."info_request_id" = 137 ORDER BY created_at LIMIT 1
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index fd42ccd9c..b09f60d40 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -806,7 +806,7 @@ public
if outgoing_messages.empty? # mainly for use with incomplete fixtures
return ""
end
- excerpt = self.outgoing_messages[0].get_text_for_indexing
+ excerpt = self.outgoing_messages.first.get_text_for_indexing
return excerpt
end