lib/mongo_mapper/plugins/associations.rb in mongo_mapper-0.7.3 vs lib/mongo_mapper/plugins/associations.rb in mongo_mapper-0.7.4
- old
+ new
@@ -82,10 +82,18 @@
self.instance_variable_set(association.ivar, proxy)
end
proxy
end
+
+ def save_to_collection(options = {})
+ super
+ associations.each do |association_name, association|
+ proxy = get_proxy(association)
+ proxy.save_to_collection(options) if proxy.proxy_respond_to?(:save_to_collection)
+ end
+ end
end
autoload :Base, 'mongo_mapper/plugins/associations/base'
autoload :Collection, 'mongo_mapper/plugins/associations/collection'
autoload :EmbeddedCollection, 'mongo_mapper/plugins/associations/embedded_collection'
@@ -95,11 +103,12 @@
autoload :ManyPolymorphicProxy, 'mongo_mapper/plugins/associations/many_polymorphic_proxy'
autoload :ManyEmbeddedProxy, 'mongo_mapper/plugins/associations/many_embedded_proxy'
autoload :ManyEmbeddedPolymorphicProxy, 'mongo_mapper/plugins/associations/many_embedded_polymorphic_proxy'
autoload :ManyDocumentsAsProxy, 'mongo_mapper/plugins/associations/many_documents_as_proxy'
autoload :OneProxy, 'mongo_mapper/plugins/associations/one_proxy'
+ autoload :OneEmbeddedProxy, 'mongo_mapper/plugins/associations/one_embedded_proxy'
autoload :InArrayProxy, 'mongo_mapper/plugins/associations/in_array_proxy'
end
end
end
-require 'mongo_mapper/plugins/associations/proxy'
\ No newline at end of file
+require 'mongo_mapper/plugins/associations/proxy'