diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-07-25 09:31:56 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-07-25 09:31:56 +0100 |
commit | dd58cd35e51c1b98228aae1aa930629e84b6a905 (patch) | |
tree | 38287e2ad0f7bf3cf2c487760f85c1457a12f656 /app/models/info_request.rb | |
parent | 26ae7efcf5ded2344aae0bd0f26ac0991c5f4bb1 (diff) |
Don't bother stripping whitespace when checking old requests: it's an expensive operation with a relatively small benefit.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 582e7aab9..db576b33d 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -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) |