Skip to content

Instantly share code, notes, and snippets.

@anasbgoncalves
Created August 21, 2017 09:48
Show Gist options
  • Save anasbgoncalves/c165b65f84cc0d94fa7ff6095781ec0d to your computer and use it in GitHub Desktop.
Save anasbgoncalves/c165b65f84cc0d94fa7ff6095781ec0d to your computer and use it in GitHub Desktop.
class RecipesController < ApplicationController
def index
@tag = query.fetch(:tags, 'all')
@recipes, @errors = Spoonacular::Recipe.random(query)
end
def show
@recipe = Spoonacular::Recipe.find(params[:id])
end
private
def query
params.fetch(:query, {})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment