At the moment if an object is passed to form_for the action and the method to which the form is submitted is hardcoded. It would be awesome to allow an object to determine its own target. The code for this is located in the method def apply_form_for_options!(record, object, options)
in file actionview/lib/action_view/helpers/form_helper.rb
. The responsible line is:
action, method = object.respond_to?(:persisted?) && object.persisted? ? [:edit, :patch] : [:new, :post]
Maybe if the object responds to something like target_action_and_method
that returns a similar array with the default given above it would be nice.
It would hopefully prevent code like written at https://github.com/bterkuile/record_collection/blob/cc8376b021a1ddd3ba44046ab530d6ea34b660ce/lib/record_collection/rails/form_helper.rb
Thanks!
Benjamin