Refactor conditions.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3153 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7959101288
commit
ddeaf9da96
@ -27,7 +27,7 @@ class Principal < ActiveRecord::Base
|
|||||||
|
|
||||||
named_scope :like, lambda {|q|
|
named_scope :like, lambda {|q|
|
||||||
s = "%#{q.to_s.strip.downcase}%"
|
s = "%#{q.to_s.strip.downcase}%"
|
||||||
{:conditions => ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ? OR LOWER(mail) LIKE ?", s, s, s, s],
|
{:conditions => ["LOWER(login) LIKE :s OR LOWER(firstname) LIKE :s OR LOWER(lastname) LIKE :s OR LOWER(mail) LIKE :s", {:s => s}],
|
||||||
:order => 'type, login, lastname, firstname, mail'
|
:order => 'type, login, lastname, firstname, mail'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user