lib/ripple/associations/one_embedded_proxy.rb in ripple-0.9.0.beta2 vs lib/ripple/associations/one_embedded_proxy.rb in ripple-0.9.0

- old
+ new

@@ -21,10 +21,17 @@ def replace(doc) @reflection.verify_type!(doc, @owner) @_doc = doc.respond_to?(:attributes_for_persistence) ? doc.attributes_for_persistence : doc assign_references(doc) - reset + + if doc.is_a?(@reflection.klass) + loaded + @target = doc + else + reset + end + @_doc end protected def find_target