This project is archived and is in readonly mode.
uniqueness with accepts_nested_attributes_of
-
Neeraj Singh
- Importance changed from to Low
Can you elaborate what you mean by when the 'select' is issued?
Can you show me the full case using console?
Thanks
-
Ivan
Sorry, I'd like to say the select 'generated' by Rails to verify if the key record already exists.
In the example, 'room_id' would be 'nil', because it wasn't set by Rails yet.
If you look in the log you can observe that SQL generated is:SELECT
objects.idFROMobjectsWHERE (objects.forniture_id= 10) AND (objects.room_idIS NULL) LIMIT 1So, even if you have 2 'Object' with the same 'forniture_id' being inserted into the same Room, the result would be as it has none.
Thanks
-
Neeraj Singh
- State changed from new to duplicate
There is already a ticket for this one.
#2646 validations not called when model updating using nested attributes