Created
October 14, 2015 13:41
-
-
Save tenpaiyomi/ee0a76faa69aa428592f 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
# Main search function | |
def self.search(params, location) | |
perform_search(location, params[:activity], params[:start_time], params[:end_time]) | |
end | |
def self.by_activity(activity) | |
perform_search("Ottawa,ON", activity, nil, nil) | |
end | |
protected | |
def perform_search(location, activity, start_time, end_time) | |
self | |
.join | |
.not_booked | |
.after_now | |
.close_to(Venue.close_to(location)) | |
.activity(Activity.find_by_name activity.titlecase) | |
.start_date(validate_start_time start_time) | |
.end_date(validate_end_time end_time) | |
.sorted | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment