I'm trying to update three records at a time with params coming back
from an HTML form. The form is set up fine and the params hash is
coming back in a form ready to use:
However, I can't catch the validation errors if the objects aren't
In my controller I have this:
if Discount.update(params[:discounts].keys, params
flash[:notice_good] = "Discounts have been updated"
redirect_to :action => 'index'
flash[:notice_bad] = "Couldn't update discounts"
redirect_to :action => 'index' and return false
I have <%= error_messages_for :discount %> in my view but can't seem
to display any validation errors.
Furthermore, it seems that my condtional "if Discount.update [...]
etc" fails if there are any errors in saving the updated data to the
Any clues on how to properly use Model.update with a params hash would