-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
my child model:
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :dedicated_to, polymorphic: true , touch: true
my parent model:
include Mongoid::Document
include Mongoid::Timestamps
has_many :dedications, as: :dedicated_to
and now see this:
irb(main):050:0> Parent.find("523aab9f8c1ec39417000242").dedications.first.touch
=> true
irb(main):050:0> a = Parent.find("523aab9f8c1ec39417000242").dedications.first.dedicated_to
irb(main):050:0> b = Parent.find("523aab9f8c1ec39417000242")
irb(main):050:0> a == b
=> true
irb(main):050:0> a.updated_at
=> Sat, 21 Sep 2013 19:45:08 UTC +00:00
irb(main):050:0> b.updated_at
=> Sun, 22 Sep 2013 15:54:55 UTC +00:00
as you see , we have an unexpected paradox here. a is updated but b is not. and even it says that a = b !