-
Type: New Feature
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Persistence
Mongoid supports polymorphism for has_one, has_many, embeds_one, and embeds_many. Current implementation stores parent actual class name in the child collection. For example, for this association belongs_to :unit, polymorphic: true the class name is stored in unit_type attribute.
There is a demand to be able to infer the class name at runtime. See this article for example.
We should allow storing arbitrary string in *_type attributes, and let the application code decide what is an actual class of the association's target.