diff options
author | francis <francis> | 2008-04-18 08:54:36 +0000 |
---|---|---|
committer | francis <francis> | 2008-04-18 08:54:36 +0000 |
commit | eea499f3dab9eae66080e20b89ab4f129d1ccf64 (patch) | |
tree | 2d850e89f9c3913ff91ee4399dd51c225b4e6d8e /app/models/info_request.rb | |
parent | 5c3baa9725554349d54eae7d879b937a52633ea3 (diff) |
Replace all special sorts with :order clauses on has_many
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 11d98e0bb..d1bd124bf 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -22,7 +22,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.92 2008-04-18 08:35:05 francis Exp $ +# $Id: info_request.rb,v 1.93 2008-04-18 08:54:36 francis Exp $ require 'digest/sha1' @@ -36,8 +36,8 @@ class InfoRequest < ActiveRecord::Base belongs_to :public_body validates_presence_of :public_body_id - has_many :outgoing_messages - has_many :incoming_messages + has_many :outgoing_messages, :order => 'created_at' + has_many :incoming_messages, :order => 'created_at' has_many :info_request_events, :order => 'created_at' has_many :user_info_request_sent_alerts has_many :track_things, :order => 'created_at desc' @@ -421,8 +421,7 @@ public if outgoing_messages.empty? # mainly for use with incomplete fixtures return "" end - messages = self.outgoing_messages.find(:all, :order => "created_at") - excerpt = messages[0].body_without_salutation + excerpt = self.outgoing_messages[0].body_without_salutation return excerpt end |