Skip to content

Commit

Permalink
Merge pull request #1 from dmliu010/patch-1
Browse files Browse the repository at this point in the history
Add email search function to Person model
  • Loading branch information
dmliu010 authored Jun 15, 2021
2 parents a7af956 + 850300b commit 5c3fea9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ def on(service_type, time)
named_scope :matching_name, lambda { |name| {
:conditions => [ "LOWER(full_name) LIKE :name", { :name => "%#{name.downcase}%"} ]
} }


named_scope :matching_email, lambda { |email| {
:conditions => [ "LOWER(email) LIKE :email", { :email => "%#{email.downcase}%"} ]
} }

named_scope :is_staff, lambda { |is_staff| {
:conditions => [ "people.staff = ?", is_staff]
} }
Expand Down

0 comments on commit 5c3fea9

Please sign in to comment.