I tried to figure out how to make RABL rendering a very simple array of JSON strings, for example: ["my,"array","of","strings"]
Controller will be
class StringsController < ApplicationController
responds_to :json
def index
@string = ['my','array','of','strings']
respond_with @strings
end
end
And the RABL view should start with:
collection @strings, root_object: false
but I canβt understand how easy it is to output lines without the name node or inside an object ...
Obviously, there is a much simpler solution for actually servicing the JSON array, like the one I put below, but I am particularly interested in why this seems so complicated in RABL!
class StringsController < ApplicationController
def index
render json: ['my','array','of','strings']
end
end
neill source
share