Skip to content

Instantly share code, notes, and snippets.

@christopherdro
Created March 2, 2013 09:18
Show Gist options
  • Save christopherdro/5070269 to your computer and use it in GitHub Desktop.
Save christopherdro/5070269 to your computer and use it in GitHub Desktop.
def find_restaurants
restaurants = Restaurant.order(:name)
restaurants = restaurants.where("name like ?", "%#{keywords}%") if keywords.present?
restaurants = restaurants.tagged_with("#{cuisine_id}") if cuisine_id.present?
restaurants = restaurants.tagged_with("241") if offer_241.blank?
restaurants = restaurants.tagged_with("50") if offer_50.blank?
restaurants
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment