I am using Simple Form in a Rails 4 app for a @user
object and have the line...
= f.input :entity_name
This generates the HTML name='user[entity_name]'
inside the input
tag. I would like to change it because of some custom processing I am doing in the controller but haven't found a way to do so.
I've tried changing the line to...
= f.input :entity_name, name: 'entity[name]'
...but this doesn't seem to affect the generated HTML at all. So far I haven't found anyone else with this question on Google/Stack Overflow.
Does anyone know if/how it's possible to change the name attribute through the Simple Form helper?
Thanks in advance!
The trick is using the input_html
option.
= f.input :entity_name, input_html: { name: 'entity[name]' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With