aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/request_controller.rb3
-rw-r--r--app/models/incoming_message.rb6
-rw-r--r--app/models/info_request.rb9
-rw-r--r--app/models/public_body.rb4
-rw-r--r--app/models/user.rb4
-rw-r--r--app/views/body/show.rhtml2
-rw-r--r--app/views/user/show.rhtml2
7 files changed, 13 insertions, 17 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 4876abcb1..daf32b802 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: request_controller.rb,v 1.74 2008-04-18 02:06:33 francis Exp $
+# $Id: request_controller.rb,v 1.75 2008-04-18 08:54:36 francis Exp $
class RequestController < ApplicationController
@@ -21,7 +21,6 @@ class RequestController < ApplicationController
# Other parameters
@info_request_events = @info_request.info_request_events
- @info_request_events.sort! { |a,b| a.created_at <=> b.created_at }
@status = @info_request.calculate_status
@collapse_quotes = params[:unfold] ? false : true
@is_owning_user = !authenticated_user.nil? && authenticated_user.id == @info_request.user_id
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'
diff --git a/app/views/body/show.rhtml b/app/views/body/show.rhtml
index 5d5c15cea..5a972831b 100644
--- a/app/views/body/show.rhtml
+++ b/app/views/body/show.rhtml
@@ -19,7 +19,7 @@
<%=pluralize(@public_body.info_requests.size, "Freedom of Information request") %> made to this authority
</h2>
- <%= render :partial => 'request/request_listing', :locals => { :info_requests => @public_body.info_requests.sort { |a,b| b.created_at <=> a.created_at } } %>
+ <%= render :partial => 'request/request_listing', :locals => { :info_requests => @public_body.info_requests } %>
<% end %>
diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml
index efad9ae63..c862dbf69 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.rhtml
@@ -56,7 +56,7 @@
made <%=pluralize(@display_user.info_requests.size, "Freedom of Information request") %>
</h2>
- <%= render :partial => 'request/request_listing', :locals => { :info_requests => @display_user.info_requests.sort { |a,b| b.created_at <=> a.created_at } } %>
+ <%= render :partial => 'request/request_listing', :locals => { :info_requests => @display_user.info_requests } %>
<% end %>
</div>