On Tuesday, June 26, 2012 3:34:50 AM UTC-7, Jamie Hodge wrote:
>
> Hi Jeremy, 
>
> My attempts to use nested_attributes with a one_to_one relationship 
> are resulting in null values to the (non-null) foreign key. Why is 
> Sequel first inserting the provided attributes and only then updating 
> the record with the foreign key? 
>

Because it was attempting to share code for both many_to_one and one_to_one 
associations.  It really shouldn't be doing that.  Try the patch at 
http://pastie.org/4154859.  This patch changes it so that it doesn't 
attempt to save a one_to_one associated object before calling the setter 
method.  It also changes the one_to_one setter method to handle new objects 
properly (removing an unneeded filter condition).

I'll be testing that patch, and should have it merged and pushed up to 
GitHub later today.  Thanks for the heads up!

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/M1jbMRfI87UJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to