Created
January 20, 2016 19:22
-
-
Save kevinchugh/64ef960ab6156baa989c to your computer and use it in GitHub Desktop.
goto
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
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