This project is archived and is in readonly mode.
form_for @object generating the wrong url if there is a rollback
-
Raf
Post request to a specific route (one specified by an id) will trigger the update action. The create action is triggered by a post request to a non-specific route (/resources instead of /resources/:id).
-
Jatinder Singh
Well actually it does check for new_record?, checkout following snippet from rails/actionpack/lib/action_view/helpers/form_helper.rb
@@@ html_options =
if object.respond_to?(:new_record?) && object.new_record? { :class => dom_class(object, :new), :id => dom_id(object), :method => :post } else { :class => dom_class(object, :edit), :id => dom_id(object, :edit), :method => :put } end -
Ryan Bigg
- State changed from new to resolved
I think this would only generate this if the record was actually saved, which is the case in a rollback because the object you create isn't going to be magically deleted by SQL. Attempt to reload the object (the method is
reload) and rescue that by returningModel.new.