How to use different templates for collection without "root" node with rabl How to use different templates for collection without "root" node with rabl json json

How to use different templates for collection without "root" node with rabl


Just remove the whole "@resources => :resources" and that should work (provided this is the content of resources/index.json.rabl and your controller sets @resources)

node do |resource|  if resource.type == 'Document'    partial('...', :object => resource)  elsif @resource.type == 'Folder'    partial('...', :object => resource)  endend

You might want to check https://github.com/rails-api/active_model_serializers as a replacement for rabl. Given your use case it might be easier to use.