This project is archived and is in readonly mode.
accepts_nested_attributes causes errors eith has_many :through relationships
-
jamesw
Since posting this ticket I have done further investigations and it looks like this problem is related to geting the fields_for declaration right but no matter what I try I can not make this work with a has_many :through association.
I realise that what I posted above is not quite right as I need to tell the params hash what parent to add the child to but including the parent in the params hash either results in a new parent being created using the child information or one of various errors depending on how I set the fields_for.
The closest I have got to a solution has been posted in the rails forum here
http://railsforum.com/viewtopic.php?id=33642I am going to abandon use if accepts_nested_attributes for the time being as this is mission critical and has held me up for far too long but if anyone is able to find a solution then please let me know (I'm watching this ticket).
Thanks
James
-
Manfred Stienstra
- State changed from new to incomplete
The exception you're getting has to do with the fact that a has_many :through relation can't inflect what it needs to change in order to make this happen. If you can find a way to work around it and provide a patch we will happily accept it. I'm closing this ticket until someone provides a patch.
-
jamesw
Thank you,
I am getting VERY VERY close to a solution.
I have actually just managed to get a child record to save, however it was saved against the wrong parent.
If I can find out the solution I'll post back here. -
Neeraj Singh
- State changed from incomplete to invalid
- Importance changed from to
Marking the ticket as invalid for now. If there is a patch and further interest in the ticket it can be reopened.