Skip to content

Instantly share code, notes, and snippets.

@kevinchugh
Created January 20, 2016 19:22
Show Gist options
  • Save kevinchugh/64ef960ab6156baa989c to your computer and use it in GitHub Desktop.
Save kevinchugh/64ef960ab6156baa989c to your computer and use it in GitHub Desktop.
goto
def goto
begin
question = Question.find params[:question][:question_number] # find will throw an exception if not found
redirect_to question # redirecting to an object will take you to the show page for that object
rescue
flash[:notice] = "sorry, error"
redirect_to :index
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment