Class: MongoMapper::Plugins::Associations::BelongsToPolymorphicProxy
- Defined in:
- lib/novelys_mongo_mapper/plugins/associations/belongs_to_polymorphic_proxy.rb
Instance Attribute Summary
Attributes inherited from Proxy
Instance Method Summary collapse
Methods inherited from Proxy
#===, #blank?, #initialize, #inspect, #loaded, #loaded?, #nil?, #present?, #proxy_respond_to?, #reload, #reset, #respond_to?, #send
Constructor Details
This class inherits a constructor from MongoMapper::Plugins::Associations::Proxy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MongoMapper::Plugins::Associations::Proxy
Instance Method Details
#replace(doc) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/novelys_mongo_mapper/plugins/associations/belongs_to_polymorphic_proxy.rb', line 7 def replace(doc) if doc doc.save if doc.new? id, type = doc.id, doc.class.name end owner[reflection.foreign_key] = id owner[reflection.type_key_name] = type reset end |