Created
November 6, 2010 06:18
-
-
Save adamgamble/665232 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 search | |
bucket = Person | |
#Narrow our query depending on params sent | |
bucket = bucket.hair_color(params["hair_color"]) unless params["hair_color"].blank? | |
bucket = bucket.enjoys_chunky_bacon(params["chunky_bacon_preference"]) unless params["chunky_bacon_preference"].blank? | |
bucket = bucket.age_between(params["age_lower_limit"], params["age_upper_limit"]) unless params["age_lower_limit"].blank? && params["age_upper_limit"].blank? | |
#This actually does the query, if no params were sent then all people will be returned. | |
@people = bucket.all | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment