Generated forms have different names

5 views
Skip to first unread message

Arne De Herdt

unread,
Nov 5, 2015, 6:15:44 AM11/5/15
to SimpleForm
Hello,

We recently upgraded from Rails 3.2 on Rails 4.2, and this also brought for us an upgrade of the SimpleForm gem along.
We're now running on the latest version and noticed the following:


In our code we had the following helper defined:

def rm_form_for(object, *args, &block)
options = args.extract_options!
options[:html] = {autocomplete: 'off'}.merge(options[:html] || {})
simple_form_for(object, *(args << options), &block)
end


When we use this method for generating a form, and pass for example a form object along called Admins::SupplierFormObject,
This would generate a form with the name for all fields set to admins_supplier_form_object, same for the params hash that was expected in the controller.
When dealing with an edit form, the hash was prepended with edit_.

However now on Rails 4 and the latest simple_form, this behaviour changed.
On the same case, we now simply have a params[:supplier] as hash for the controller, and the wrapper for the HTML also changed from admins_supplier_form_object into supplier.
Is this an intended change from simple_form, or does this come from rails?
And can we have the described behaviour back again somehow?

Kind regards,
Arne
Reply all
Reply to author
Forward
0 new messages