Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Strong_parameters support #199

Closed
kibs opened this Issue · 4 comments

2 participants

@kibs

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 closed this issue from a commit
@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
@lest
Collaborator

Fixed in d742482111a469df87f937904192ef8a4ceb21e1. Thanks!

@kibs

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

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

ahh okay! makes sense! Thanks for fixing this

@ghostganz ghostganz referenced this issue from a commit
@ghostganz ghostganz jQuery: Making generated ids easily overridable
The ids were previously prefixed with 'new_', which we found useful,
but that was removed when #199 was fixed.
e4a1570
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.