lib/hungry/resource.rb in hungry-0.1.2 vs lib/hungry/resource.rb in hungry-0.1.3
- old
+ new
@@ -38,11 +38,13 @@
klass = Kernel.const_get(klass) if klass.is_a?(String)
if object_or_attributes.is_a?(klass)
@belongs_to[resource] = object_or_attributes
- else
+ elsif object_or_attributes.present?
@belongs_to[resource] = klass.new object_or_attributes
+ else
+ @belongs_to[resource] = nil
end
@belongs_to[resource]
end
end