-
Type:
Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
When using fields with a custom serialization class, Mongoid doesn't seem to cache the object we're assigning, and instead it's mongoizing/demongoizing the value each time it's accessed:
class Document include Mongoid::Document field :foo, type: Foo end doc = Document.new doc.foo = Foo.new doc.foo === doc.foo # => false
Note: all built-in field types do not seem to behave this way, and calling doc.foo === doc.foo on them returns true.
Not sure if this is an expected behavior, but it would be cool if it was mentioned somewhere in the docs.