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