If I have a jbuilder template containing this code:
json.reportable do |reportable|
json.(report.reportable, *report.reportable_type.constantize.column_names)
end
How can I name the node by the reportable.report.reportable_type attribute, instead of "reportable" ?
well, it is right there in the documentation
json.set! report.reportable_type.underscore do |reportable|
json.(report.reportable, *report.reportable_type.constantize.column_names)
end