On Feb 23, 11:40 pm, Jeremy Evans <[email protected]> wrote:
> In this particular case, I think this will work:
>
>   Main.many_to_one :derived, :key=>:id
>   Derived.many_to_one :main, :key=>:id
>
> You could use one_to_one as well, but many_to_one is simpler and
> should work.
Hi Jeremy,
Thanks for replying.

What is the sequence of creates and saves that I should use to get
this done. If I do something like this:

m = Main.create(:other_field => 1)
d = Derived.create(:other => 11)
m.derived = d
m.save
this doesnt implicitly save d as weel. Probably because Sequel doesnt
use proxies.

Should I be doing this:
m = Main.create(:other_field => 1)
d = Derived.create(:other => 11)
m.save
m.add_derived(d) # at THIS point, does d get the primary key of
m's :id ?

-Sandeep

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
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