Aside from the fact that the 'edit' method in the following
product_admin_controller is using request.post? instead of creating a
separate 'update' method, are there any issues with the code that is
immediately apparent and I am overlooking?
def edit
@product = Product.find(params[:id])
if request.post?
if @product.update_attributes(params[:product])
flash[:notice] = "Success."
redirect_to :action => 'list'
unless @product.styles_valid?
flash[:notice] = "Error."
else
flash[:notice] = "Success."
end
else
flash[:notice] = "Error."
flash[:error_field] = :product
end
end
end
I have tried to insert a raise after request.post? but my application
doesn't make contact with this.
Of course, I've ensured my form method is set to "post".
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.