diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-04-21 16:07:35 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-04-27 12:13:27 +0100 |
commit | bfe3724ab753001a8171afff157b3f87de6883e4 (patch) | |
tree | 9acb982e2f880a09b163036de86c5a082f82bd00 | |
parent | b10f2a0c053b4097c0cbace9c509044444544d09 (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
-rw-r--r-- | app/models/info_request.rb | 2 |
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 |