This project is archived and is in readonly mode.

#3361 ✓invalid
tim

accepts_nested_attributes_for and has_one relations

Reported by tim | October 9th, 2009 @ 05:56 PM | in 2.3.6

when you add accepts_nested_attributes_for(:child) to a "parent" model, the "child" objects will be saved automaticly. But they are not going to be validated automaticly.
This means you will add invalid object into the database by default, since validation for child in a has_one relations are turned of by default.

I suggest to set autosave and validation to true by accepts_nested_attributes_for !!!

In our case, in combination with attachment_fu which use after-validation-callbacks to save the file, we searched a long-time to find the source why there was no file.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages