lib/restly/associations/base/stubs.rb in restly-0.0.1.alpha.11 vs lib/restly/associations/base/stubs.rb in restly-0.0.1.alpha.12

- old
+ new

@@ -16,10 +16,14 @@ end Restly::Proxies::Associations::Collection.new(collection, parent) end def stub_instance(parent, attributes) - instance = association_class.new(attributes, loaded: embedded?) - Restly::Proxies::Associations::Instance.new(instance, parent) + if attributes.is_a?(association_class) + attributes + else + new_instance = association_class.new(attributes, loaded: embedded?) + Restly::Proxies::Associations::Instance.new(new_instance, parent) + end end end \ No newline at end of file