Created
November 13, 2014 20:57
-
-
Save antillas21/bd5012fb04199164be86 to your computer and use it in GitHub Desktop.
Client.search
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 Client < ActiveRecord::Base | |
scope :search, ->(term) { | |
clients_table = self.arel_table | |
column = clients_table[:name] | |
where(column.matches("%#{term}%")) | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment