nesquena/rabl — Issue #144: trying to render an application view with status and within it to render the collection view
Author: vladshub
Created: 2011-12-05 19:07:38+00:00
State: open

Hi,
I have a project where i need to return a list of objects and when the object name ends with "s" it returns a messed up object

#Application.rabl
status = @error.nil? ? "OK" : "ERROR"

node(:status) { status }

if @error.nil?
node(:result) do
JSON.parse(yield)
end
else
node(:error) { @error.html_safe }
end

#One collection.rabl
collection @cols
attributes :id, :name

#return json
[{"cols": {"result":[{"col":{"name","id"}}]}}]

can you please advice on the correct way to do that