This project is archived and is in readonly mode.
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
-
Eloy Duran December 30th, 2009 @ 07:39 PM
- Milestone set to 2.3.6
- Assigned user set to Eloy Duran
-
Eloy Duran January 3rd, 2010 @ 09:04 PM
- State changed from new to invalid
I wasn't able to spot this bug anymore, at least not on my current 2-3-stable and master branches. In case it still exists there, could you create a test case that demonstrates the problem?
Closing for now, thanks.
-
Oleg April 15th, 2010 @ 04:01 PM
This is a bit messed up. I'm experiencing the same issue.
accepts_nested_attributes_for for has_one completely skips validation on the nested element. has_many works fine though.
I'm using 2.3.5, ruby 1.8.7p173
-
Oleg April 15th, 2010 @ 04:01 PM
This is a bit messed up. I'm experiencing the same issue.
accepts_nested_attributes_for for has_one completely skips validation on the nested element. has_many works fine though.
I'm using 2.3.5, ruby 1.8.7p173
-
Oleg April 15th, 2010 @ 04:05 PM
never mind, I re-froze 2.3.5 and started to work. I must have frozen rails before it became 'really stable'
-
xhming July 19th, 2010 @ 07:33 AM
- Importance changed from to
e exorbitantly replica Hermes handbags cheap sale supernal monopoly their singularity Dior handbags replica whereas compared to skin handbags on sale carry bags. Canvas move cheap replica Boston replica NEW ITEMS wholesale replica Burberry wallet wholesale Cartier cheap replica Loewe handbags handbags for cheap cheap replica Hermes handbags
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>