Skip to content

Instantly share code, notes, and snippets.

@spohlenz
Created November 16, 2008 22:25
Show Gist options
  • Save spohlenz/25578 to your computer and use it in GitHub Desktop.
Save spohlenz/25578 to your computer and use it in GitHub Desktop.
The wrong way to set a flash error
def create
@recipe = Recipe.new(params[:recipe])
if @recipe.save
flash[:notice] = 'Recipe was successfully created.'
redirect_to recipes_path
else
flash[:error] = 'The recipe failed to save.'
render :action => 'new'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment