diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/incoming_message.rb | 6 | ||||
-rw-r--r-- | app/models/info_request.rb | 9 | ||||
-rw-r--r-- | app/models/public_body.rb | 4 | ||||
-rw-r--r-- | app/models/user.rb | 4 |
4 files changed, 10 insertions, 13 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 6bc8543ab..b21a638c7 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -17,7 +17,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: incoming_message.rb,v 1.78 2008-04-16 12:00:10 francis Exp $ +# $Id: incoming_message.rb,v 1.79 2008-04-18 08:54:36 francis Exp $ # TODO @@ -70,9 +70,7 @@ class IncomingMessage < ActiveRecord::Base validates_presence_of :raw_data - has_many :rejection_reasons - - has_many :outgoing_message_followups, :class_name => OutgoingMessage + has_many :outgoing_message_followups, :foreign_key => 'incoming_message_followup_id', :class_name => 'OutgoingMessage' # Return the structured TMail::Mail object # Documentation at http://i.loveruby.net/en/projects/tmail/doc/ 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 diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 61a98d425..a57bf2d2c 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body.rb,v 1.62 2008-04-17 22:39:21 francis Exp $ +# $Id: public_body.rb,v 1.63 2008-04-18 08:54:36 francis Exp $ require 'csv' require 'set' @@ -33,7 +33,7 @@ class PublicBody < ActiveRecord::Base validates_uniqueness_of :short_name, :if => Proc.new { |pb| pb.short_name != "" } validates_uniqueness_of :name - has_many :info_requests + has_many :info_requests, :order => 'created_at desc' has_many :public_body_tags def self.categories_with_description diff --git a/app/models/user.rb b/app/models/user.rb index 540dcb648..b6d3e2b48 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user.rb,v 1.49 2008-04-15 12:06:59 francis Exp $ +# $Id: user.rb,v 1.50 2008-04-18 08:54:36 francis Exp $ require 'digest/sha1' @@ -33,7 +33,7 @@ class User < ActiveRecord::Base validates_presence_of :hashed_password, :message => "^Please enter a password" - has_many :info_requests + has_many :info_requests, :order => 'created_at desc' has_many :user_info_request_sent_alerts has_many :post_redirects has_many :track_things, :foreign_key => 'tracking_user_id', :order => 'created_at desc' |