Merge branch '171-user_test_fails_with_mysql2'
This commit is contained in:
commit
a47a7a2b99
|
@ -279,8 +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/i) ? '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])
|
||||||
# Fail over to case-insensitive if none was found
|
# Fail over to case-insensitive if none was found
|
||||||
|
|
Loading…
Reference in New Issue