Module: Mongoid::Relations::Polymorphic::ClassMethods
- Defined in:
- lib/mongoid/relations/polymorphic.rb
Instance Method Summary collapse
-
#polymorph(metadata) ⇒ Class
Attempts to set up the information needed to handle a polymorphic relation, if the metadata checks out.
Instance Method Details
#polymorph(metadata) ⇒ Class
Attempts to set up the information needed to handle a polymorphic relation, if the metadata checks out.
27 28 29 30 31 32 33 34 35 |
# File 'lib/mongoid/relations/polymorphic.rb', line 27 def polymorph() if .polymorphic? self.polymorphic = true if .relation.stores_foreign_key? field(.inverse_type, type: String) end end self end |