ryanb / nested_form

Rails plugin to conveniently handle multiple models in a single form.
MIT License
1.79k stars 505 forks source link

Strong_parameters support #199

Closed kibs closed 12 years ago

kibs commented 12 years ago

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

nested_form adds a "new" to the autogenerated ID, see https://github.com/ryanb/nested_form/issues/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 https://github.com/rails/strong_parameters/pull/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 commented 12 years ago

Fixed in d742482111a469df87f937904192ef8a4ceb21e1. Thanks!

kibs commented 12 years ago

Actually looking into why the new_ was added in the first place https://github.com/ryanb/nested_form/issues/21 I am not sure removing new_ is a good idea

lest commented 12 years ago

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 commented 12 years ago

ahh okay! makes sense! Thanks for fixing this