As pointed out in #1572 and #4568, there is no uniqueness validation for nested attributes. It does check against the db for duplicate records but doesn't check the collection being passed in. This checks for that only when there is a uniqueness validation defined in the associated model.
It is a basic uniqueness validation by combining the attributes defined in the uniqueness validator. I've chosen to only pull the necessary attributes to generate the "key" instead of all attributes jeyb@1f618ff in case there are timestamps that or other user generated content that throws off the uniqueness check.
Let me know what you guys think.
Failing spec for uniqueness validation on accepts_nested_attributes_for.
Perform uniqueness validation on accepts_nested_attributes_for.
Only check the fields marked as unique along with their scopes, inste…
…ad of all attributes.
/cc @jonleighton @tenderlove
@jeyb can you squash the commits, please?
@steveklabnik @jonleighton @tenderlove any comments on this PR?
Is there any status on the acceptance of this PR? I am encountering this exact issue, and would much appreciate this getting merged.
I've experienced the very same issue just now with rails 3.2.13. Any feedback for this?
Closing for the same reason as #4568 and #11851