Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use LIKE instead of LOWER to take advantage of database indices

  • Loading branch information...
commit ca37d8a959c4533de151f7974721c70330c7d661 1 parent a8835ab
@binarylogic binarylogic authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/authlogic/acts_as_authentic/login.rb
View
3  lib/authlogic/acts_as_authentic/login.rb
@@ -118,7 +118,8 @@ def find_with_case(field, value, sensitivity = true)
if sensitivity
send("find_by_#{field}", value)
else
- where("LOWER(#{quoted_table_name}.#{field}) = ?", value.mb_chars.downcase).first
+ like_word = ::ActiveRecord::Base.connection.adapter_name == "PostgreSQL" ? "ILIKE" : "LIKE"
+ where("#{quoted_table_name}.#{field} #{like_word} ?", value.mb_chars).first
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.