diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/info_request.rb | 3 | ||||
-rw-r--r-- | app/models/track_thing.rb | 6 | ||||
-rw-r--r-- | app/models/user.rb | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 2ec8ead1f..a1f2dcd7e 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.81 2008-04-04 01:44:41 francis Exp $ +# $Id: info_request.rb,v 1.82 2008-04-04 02:29:09 francis Exp $ require 'digest/sha1' @@ -40,6 +40,7 @@ class InfoRequest < ActiveRecord::Base has_many :incoming_messages has_many :info_request_events has_many :user_info_request_sent_alerts + has_many :track_things, :order => 'created_at desc' # user described state (also update in info_request_event, admin_request/edit.rhtml) validates_inclusion_of :described_state, :in => [ diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index c71dd6f4c..778252c53 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -21,16 +21,16 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: track_thing.rb,v 1.6 2008-04-04 01:59:40 francis Exp $ +# $Id: track_thing.rb,v 1.7 2008-04-04 02:29:09 francis Exp $ class TrackThing < ActiveRecord::Base - belongs_to :user, :foreign_key => 'tracking_user_id' + belongs_to :tracking_user, :class_name => 'User' validates_presence_of :track_query validates_presence_of :track_type belongs_to :info_request belongs_to :public_body - belongs_to :user, :foreign_key => 'tracked_user_id' + belongs_to :tracked_user, :class_name => 'User' has_many :track_things_sent_emails diff --git a/app/models/user.rb b/app/models/user.rb index 3d2ae91d3..ca72ea254 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.46 2008-04-04 01:44:41 francis Exp $ +# $Id: user.rb,v 1.47 2008-04-04 02:29:09 francis Exp $ require 'digest/sha1' @@ -36,7 +36,7 @@ class User < ActiveRecord::Base has_many :info_requests has_many :user_info_request_sent_alerts has_many :post_redirects - has_many :track_things, :foreign_key => 'tracking_user_id' + has_many :track_things, :foreign_key => 'tracking_user_id', :order => 'created_at desc' attr_accessor :password_confirmation validates_confirmation_of :password, :message =>"^Please enter the same password twice" |