Hi all,
I have some problems with a few temporary objects, this is the relation
between them:
A -(1,n)-> B -(1,1)-> C
B -(1,n)-> D
C -(1,n)-> D
I have a "wizard" to create "A" objects, I''m
storing everything in the
session, something like this:
a = A.new
session[:a_object] = a
...
b = B.new
b.c = some_c_instace
a.bs << b
...
d = D.new
b.ds << d
then, after the wizard finishes, I want to save the structure in the DB,
like this:
a.save
But it won''t work, active record says that the collections (bs and ds)
are not valid.
I have done this before, but with only one level: like if there was no
relation between B and D...
I think that ActiveRecord should do this:
save A -> assign the pkey to the relation of Bs
save Bs -> assign the pkey to the relation of Ds
but apparently it''s not doing so...
Any ideas?
thanks.
--
Posted via http://www.ruby-forum.com/.