photo=Photo.find params[:id]
unless photo.update_attributes params
#error handling
end
On 27 Dec 2005, at 6:31am, Justin Rhoades wrote:
> So I''m updating multiple model objects in one go with something
> like this in my controller:
> => Photo.update(params[:photo].keys, params[:photo].values)
>
> When the update fails due to validation errors, how do I detect it?
> The Rails API says:
> "If the save fails under validations, the unsaved object is still
> returned."
> So I can''t simply do this:
> => if Photo.update(params[:photo].keys, params[:photo].values)
>
> Any suggestions?
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails