##// END OF EJS Templates
Refactor conditions....
Eric Davis -
r3039:ddeaf9da965c
parent child
Show More
@@ -27,7 +27,7 class Principal < ActiveRecord::Base
27
27
28 named_scope :like, lambda {|q|
28 named_scope :like, lambda {|q|
29 s = "%#{q.to_s.strip.downcase}%"
29 s = "%#{q.to_s.strip.downcase}%"
30 {:conditions => ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ? OR LOWER(mail) LIKE ?", s, s, s, s],
30 {:conditions => ["LOWER(login) LIKE :s OR LOWER(firstname) LIKE :s OR LOWER(lastname) LIKE :s OR LOWER(mail) LIKE :s", {:s => s}],
31 :order => 'type, login, lastname, firstname, mail'
31 :order => 'type, login, lastname, firstname, mail'
32 }
32 }
33 }
33 }
General Comments 0
You need to be logged in to leave comments. Login now