Strong_parameters support #199

Closed
kibs opened this Issue Oct 4, 2012 · 4 comments

Projects

None yet

2 participants

@kibs
kibs commented Oct 4, 2012

I am having a bit of trouble getting nested_form working with strong_paramters.

nested_form adds a "new" to the autogenerated ID, see #21 but strong_parameters only supports nested attributes keys containg only numeric values negative or positive numbers.

I have created a pull request adding a failed test to strong parameters rails/strong_parameters#40 but i would like to hear your opinion regarding this matter. I would think it is quite difficult getting strong_parameters working with "new"

@lest lest added a commit that closed this issue Oct 5, 2012
@lest lest don't prepend new_ to the nested fields keys
In order to be compatible with strong_parameters as it detects nested
fields array only with numeric keys.

Closes #199.
ec5ed66
@lest lest closed this in ec5ed66 Oct 5, 2012
@lest
Collaborator
lest commented Oct 5, 2012

Fixed in d742482111a469df87f937904192ef8a4ceb21e1. Thanks!

@kibs
kibs commented Oct 5, 2012

Actually looking into why the new_ was added in the first place #21
I am not sure removing new_ is a good idea

@lest
Collaborator
lest commented Oct 5, 2012

fields_for doesn't use id field as key. It uses auto-incremental number started from 0. So conflict may occur only on rendering a form with million of nested fields.

Maybe at the time of #21 there was a different behavior but now it's not required to add new_ prefix.

@kibs
kibs commented Oct 5, 2012

ahh okay! makes sense! Thanks for fixing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment