heartcombo / simple_form

Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup.
http://blog.plataformatec.com.br/tag/simple_form
MIT License
8.22k stars 1.32k forks source link

When the field name is changed. The input does not save with the form object. #1715

Closed RailsCod3rFuture closed 3 years ago

RailsCod3rFuture commented 4 years ago

Greetings, I'm having an issue where inputs are saving outside of the hash for the object.

<%= f.input :city, input_html: {name: 'new_city'} %>

Server logs

Parameters: {"form_object" => {"info_attributes"=> {.....}}}, "city" => "new york"

Does not save whatsoever.

Expected behavior: input value is saved when form is saved

Actual behavior: Input value is saved outside of form object as single attributes and don't save to the model

Does anyone know why this is happening?

carlosantoniodasilva commented 4 years ago

Can you share the whole form?

My best guess is that you might be using nested attributes (because of info_attributes there), and your f.input :city is actually referencing the main form and not the fields_for nested piece.

feliperenan commented 3 years ago

Hi @RailsCod3rFuture 👋🏻

Please let us know if you are still facing this issue and provide the info requested above if so. Closing this issue for the time being :)