lib/ripple/associations/one_embedded_proxy.rb in ripple-0.7.1 vs lib/ripple/associations/one_embedded_proxy.rb in ripple-0.8.0.beta
- old
+ new
@@ -18,10 +18,11 @@
class OneEmbeddedProxy < Proxy
include One
include Embedded
def replace(doc)
+ @reflection.verify_type!(doc, @owner)
@_doc = doc.respond_to?(:attributes_for_persistence) ? doc.attributes_for_persistence : doc
assign_references(doc)
reset
@_doc
end
@@ -31,9 +32,8 @@
return nil unless @_doc
klass.instantiate(@_doc).tap do |doc|
assign_references(doc)
end
end
-
end
end
end