relaxing the test for mysql to make it work for mysql2 adapter

This commit is contained in:
Gregor Schmidt 2011-02-10 18:47:26 +01:00
parent 98f85b3332
commit 63c92189a8
1 changed files with 1 additions and 1 deletions

View File

@ -279,7 +279,7 @@ class User < Principal
# version. Exact matches will be given priority. # version. Exact matches will be given priority.
def self.find_by_login(login) def self.find_by_login(login)
# force string comparison to be case sensitive on MySQL # force string comparison to be case sensitive on MySQL
type_cast = (ActiveRecord::Base.connection.adapter_name == 'MySQL') ? 'BINARY' : '' type_cast = (ActiveRecord::Base.connection.adapter_name =~ /mysql/) ? 'BINARY' : ''
# First look for an exact match # First look for an exact match
user = first(:conditions => ["#{type_cast} login = ?", login]) user = first(:conditions => ["#{type_cast} login = ?", login])