diff options
author | David Cabo <david@calibea.com> | 2011-07-26 02:39:57 +0200 |
---|---|---|
committer | David Cabo <david@calibea.com> | 2011-07-26 02:39:57 +0200 |
commit | 058a65ae0d079729b10a2954c472c336dce43245 (patch) | |
tree | 91543599b6db6538ceb2cdb36aaa9057ffe066fc /app/models/info_request.rb | |
parent | 1ac1e5df9e1b8e670fbab1d2c65de6ce28232602 (diff) | |
parent | 04927e448f99f67bbfde88dd466f03fb23373b28 (diff) |
Merge branch 'master' of github.com:sebbacon/alaveteli into asktheeu
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 9182b6ae7..209954b16 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -112,7 +112,7 @@ class InfoRequest < ActiveRecord::Base include InfoRequestCustomStates @@custom_states_loaded = true end - rescue MissingSourceFile + rescue MissingSourceFile, NameError end # only check on create, so existing models with mixed case are allowed @@ -347,14 +347,7 @@ public # XXX this *should* also check outgoing message joined to is an initial # request (rather than follow up) def InfoRequest.find_by_existing_request(title, public_body_id, body) - # XXX can add other databases here which have regexp_replace - if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" - # Exclude spaces from the body comparison using regexp_replace - return InfoRequest.find(:first, :conditions => [ "title = ? and public_body_id = ? and regexp_replace(outgoing_messages.body, '[[:space:]]', '', 'g') = regexp_replace(?, '[[:space:]]', '', 'g')", title, public_body_id, body ], :include => [ :outgoing_messages ] ) - else - # For other databases (e.g. SQLite) not the end of the world being space-sensitive for this check - return InfoRequest.find(:first, :conditions => [ "title = ? and public_body_id = ? and outgoing_messages.body = ?", title, public_body_id, body ], :include => [ :outgoing_messages ] ) - end + return InfoRequest.find(:first, :conditions => [ "title = ? and public_body_id = ? and outgoing_messages.body = ?", title, public_body_id, body ], :include => [ :outgoing_messages ] ) end def find_existing_outgoing_message(body) |