Skip to content

Instantly share code, notes, and snippets.

@andyh
Forked from jheg/gist:bb1a6327fcd6f5884fa2
Last active August 29, 2015 14:14
Show Gist options
  • Save andyh/95770e17a8df4059c4d3 to your computer and use it in GitHub Desktop.
Save andyh/95770e17a8df4059c4d3 to your computer and use it in GitHub Desktop.
def set_category
# current_user dealt with in before filter
@category = current_user.categories.find(params[:id])
rescue ActiveRecord::RecordNotFound
flash[:error] = "The category you're looking for could not be found."
redirect_to root_path
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment