-
Type:
Task
-
Status: Closed
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: 3.1.0
-
Component/s: None
-
Labels:None
It seems if you have a model that creates a child in :after_create but relies on changed state in :after_save, it no longer works as of e1c4f0bc8d7bd3077147638099392054418ae03f.
context "regression" do |
class TestOther |
include Mongoid::Document
|
belongs_to :test_regression |
end |
|
class TestRegression |
include Mongoid::Document
|
|
has_many :test_others |
|
field :a |
field :b |
|
after_create :create_other |
after_save :update_b |
|
def create_other |
test_others.create()
|
end |
|
def update_b |
if a_changed? && b.nil? |
update_attributes(:b => "foo") |
end |
end |
end |
|
it "does not work" do |
t = TestRegression.create(:a => "Hi") |
t.reload().b.should == "foo" |
end |
end |