Rails Unique Validate Broken

Last Friday I was implementing a feature for a Rails 3 website. It required kind of a ‘bulk insert’ form. Based on the relationships a nested form setup powered by Cocoon gem was possible. The client was happy of the speed of delivery and for a moment I was hero.

Then came the complain that the form allowed him to create 2 duplicate reocrds. I was suspicious, so I looked at the staging server my self. Bingo! There indeed was a duplicate. This was not a probelm if we tried to create a new record for some thing already in the database. But it will not validate uniqueness for the nested form.

To see there is an open issue from quite some time.


It was a little dissapointing to see such an issue still been open with no PR on the matter. Planning to get it fixed and a PR made when I get free.