ryanb / nested_form

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

ActiveRecord::NestedAttributes::TooManyRecords error #63

Open danimashu opened 13 years ago

danimashu commented 13 years ago

Quikly. When I have in my model:

accepts_nested_attributes_for :foofoo, :allow_destroy => true, :limit => 2

When I do the next I get the error. But it shouldn't show because only one FooFoo is submiting and the limit is 2. Althought I delete the FooFoo, when I overcome the limit, althought I delete the rest before of submit the form, I get the error.

Add FooFoo x 3
Delete FooFoo x 2
Submit Form

Any help?

ryanb commented 13 years ago

Hmm, the nested_form does not know about the :limit option. I guess it would be smart to handle this. Thanks for reporting.