lib/garage/representer.rb in the_garage-2.0.2 vs lib/garage/representer.rb in the_garage-2.0.3
- old
+ new
@@ -155,10 +155,10 @@
value = object.send(@name)
encode_value(value, responder, selector)
end
def encode_value(value, responder, selector)
- if !value.nil? && value.respond_to?(:represent!)
+ if value.is_a?(Garage::Representer)
responder.encode_to_hash(value, partial: true, selector: selector)
elsif primitive?(value)
value
else
raise NonEncodableValue, "#{value.class} can not be encoded directly. Forgot to include Garage::Representer?"