-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Hi,
After fighting a bit with my specs, I realized the bug lived in my Observer, precisely in it's after_save method:
def after_save(obj)
binding.pry
do_something if obj.status == "foo"
end
Basically, within debugger:
One the one hand:
obj.status
#=> "bar"
On the other hand:
parent = obj._root.reload
reloaded_obj = parent.children.where(:_id => obj.id).first
reloaded_obj.status #=> "foo"
I conclude, that my embedded obj doesn't bear it's updated values within my the{{ after_save}} method in the Observer.
My configuration is:
- rails '3.0.10'
- mongoid '2.2.4'