aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/request_controller.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-02-13 09:32:55 +0000
committerfrancis <francis>2008-02-13 09:32:55 +0000
commit09a83c9c870bb96d8873e6d68074703439f9f839 (patch)
tree448afd2db455940f727ebd6f409bce8380397b52 /app/controllers/request_controller.rb
parent3305da49f355e19ba5dde99a5faed92a2c99ce92 (diff)
Move a tiny bit of logic into the model.
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r--app/controllers/request_controller.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 4e40f0e7f..be193cc2d 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.46 2008-02-07 15:11:16 francis Exp $
+# $Id: request_controller.rb,v 1.47 2008-02-13 09:32:55 francis Exp $
class RequestController < ApplicationController
@@ -41,11 +41,10 @@ class RequestController < ApplicationController
end
# See if the exact same request has already been submitted
- # XXX this *should* also check outgoing message joined to is an initial request (rather than follow up)
- # XXX this check could go in the model, except we really want to pass @existing_request to the view so it can link to it.
- # XXX could have a date range here, so say only check last month's worth of new requests. If somebody is making
- # repeated requests, say once a quarter for time information, then might need to do that.
- @existing_request = InfoRequest.find(:first, :conditions => [ 'title = ? and public_body_id = ? and outgoing_messages.body = ?', params[:info_request][:title], params[:info_request][:public_body_id], params[:outgoing_message][:body] ], :include => [ :outgoing_messages ] )
+ # XXX this check should theoretically be a validation rule in the
+ # model, except we really want to pass @existing_request to the view so
+ # it can link to it.
+ @existing_request = InfoRequest.find_by_existing_request(params[:info_request][:title], params[:info_request][:public_body_id], params[:outgoing_message][:body])
# Create both FOI request and the first request message
@info_request = InfoRequest.new(params[:info_request])