Created
April 24, 2013 10:09
-
-
Save peteroome/5451096 to your computer and use it in GitHub Desktop.
Searching. Building up a query
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
def self.search(params) | |
scope = scoped({}) | |
scope = scope.scoped :where => ['title_id = ?', params[:title_id] ] unless params[:title_id].blank? | |
scope = scope.scoped :where => ['upper(first_name) like upper(?)', params[:first_name] ] unless params[:manufacturers].blank? | |
scope | |
end |
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
@results = Student.search(params) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment