Permalink
Browse files

If errors updating Entity, assign meaningful msgs to flash[:error]

  • Loading branch information...
1 parent 217a031 commit d1f1f451c39cb1c668ac6257765d5d2c4e01b65d @andey committed Jan 28, 2013
Showing with 3 additions and 0 deletions.
  1. +3 −0 app/controllers/entities_controller.rb
@@ -52,6 +52,9 @@ def update
if @entity.update_attributes(params[:entity])
format.html { redirect_to entity_path(@entity), :notice => 'Entity was successfully updated.' }
else
+ if @entity.errors.any?
+ flash[:error] = @entity.errors.full_messages.to_sentence
+ end
format.html { redirect_to entity_path(@entity), :notice => 'Entity was unable to update.' }
end
end

0 comments on commit d1f1f45

Please sign in to comment.