Created
August 27, 2013 00:20
-
-
Save BenEddy/6348301 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
attr_accessible :email, :first_name, :last_name | |
def self.name_matching(name) | |
where("lower(first_name) LIKE lower(:name) | |
OR lower(last_name) LIKE lower(:name)", name: name + "%") | |
end | |
def self.email_matching(email) | |
where("lower(email) LIKE lower(?)", email + "%") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment