Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Update previous nested objects are recreated #88

Open
mfts opened this issue Mar 22, 2017 · 1 comment
Open

On Update previous nested objects are recreated #88

mfts opened this issue Mar 22, 2017 · 1 comment

Comments

@mfts
Copy link

mfts commented Mar 22, 2017

When I'm creating a object with a nested object via nested_form_fields everything works well.
When I go to edit but don't change my inputs, a new and identical nested object is created.

Rails 5.0.1, Ruby 2.3.1, Mongoid 6.1.0

screen shot 2017-03-22 at 12 15 13
screen shot 2017-03-22 at 12 15 40
screen shot 2017-03-22 at 12 15 58
screen shot 2017-03-22 at 12 16 16

@ncri
Copy link
Owner

ncri commented Mar 23, 2017

My guess is you didn't allow the id of the nested elements in permitted parameters. You might also need to add a hidden id field in the nested forms. It should all work fine then. If no id is submitted or the id is not a permitted parameter, rails thinks the submitted object is a new record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants