Module: UcbRailsUser::UserSearch
- Defined in:
- app/models/ucb_rails_user/user_search.rb
Class Method Summary collapse
Class Method Details
.find_users_by_name(name) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/models/ucb_rails_user/user_search.rb', line 3 def self.find_users_by_name(name) return [] unless name.present? (name1, name2) = name.split query = case_insenstive(:first_name, name1) .or(case_insenstive(:last_name, name1)) if name2.present? query = query .or(case_insenstive(:first_name, name2)) .or(case_insenstive(:last_name, name2)) end query.order(:last_name, :first_name) end |