diff --git a/app/models/principal.rb b/app/models/principal.rb index ff9b686..9ec0f6f 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -27,7 +27,7 @@ class Principal < ActiveRecord::Base named_scope :like, lambda {|q| 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' } }