Class: MongoMapper::Plugins::Associations::OneEmbeddedPolymorphicProxy

Inherits:
OneEmbeddedProxy show all
Defined in:
lib/mongo_mapper/plugins/associations/proxy/one_embedded_polymorphic_proxy.rb

Instance Attribute Summary

Attributes inherited from Proxy

#association, #proxy_owner, #target

Instance Method Summary collapse

Methods inherited from OneEmbeddedProxy

#build, #save_to_collection

Methods inherited from Proxy

define_proxy_method, #initialize, #inspect, #loaded, #loaded?, #proxy_method, #proxy_respond_to?, #read, #reload, #reset, #respond_to?, #write

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(value) ⇒ Object



6
7
8
9
# File 'lib/mongo_mapper/plugins/associations/proxy/one_embedded_polymorphic_proxy.rb', line 6

def replace(value)
  @value = value.respond_to?(:attributes) ? value.attributes.merge(association.type_key_name => value.class.name) : value
  reset
end