Anybody?
On Jul 16, 10:41 am, Ryan Frith
<ralaf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> If I have 2 models defined as such:
>
> class ClassA < ActiveRecord::Base
> before_create "class_b.foo"
> has_one :class_b
> def foobar
> puts "foobar"
> end
> end
>
> ClassB < ActiveRecord::Base
> after_create :bar
> belongs_to :class_a
> def foo
> puts "foo"
> end
> def bar
> class_a.foobar
> end
> end
>
> And somewhere I do this:
>
> a = ClassA.new
> b = ClassB.new
> a.class_b = b
> a.save
>
> Which object will get created first, and in turn, have it''s
lifecycle
> method called first? In other words, will ClassA definitely get
> created before ClassB, or vise versa? Is there any guarantee to the
> order of saving objects in the graph?
>
> Thanks in advance,
>
> Ryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---