lib/praxis-blueprints/renderer.rb in praxis-blueprints-3.1 vs lib/praxis-blueprints/renderer.rb in praxis-blueprints-3.2
- old
+ new
@@ -53,11 +53,18 @@
rescue SystemStackError
raise CircularRenderingError.new(object, context)
end
def _render(object, fields, view=nil, context: Attributor::DEFAULT_ROOT_CONTEXT)
- return object if fields == true
+ if fields == true
+ return case object
+ when Attributor::Dumpable
+ object.dump
+ else
+ object
+ end
+ end
notification_payload = {
blueprint: object,
fields: fields,
view: view
@@ -72,10 +79,15 @@
end
next if value.nil? && !self.include_nil
if subfields == true
- hash[key] = value
+ hash[key] = case value
+ when Attributor::Dumpable
+ value.dump
+ else
+ value
+ end
else
new_context = context + [key]
hash[key] = self.render(value, subfields, context: new_context)
end