I've been trying to figure out how to make RABL render a very simple JSON array of string, such as: ["my,"array","of","strings"]
The controller would be
class StringsController < ApplicationController
responds_to :json
def index
@string = ['my','array','of','strings']
respond_with @strings
end
end
And the RABL view must surely start with:
collection @strings, root_object: false
but I cannot figure out how to just output the strings without a node name or within an object...
There is obviously a much more straightforward solution to actually serving up the JSON array, much like what I've put below, but I'm specifically interested in why this seems so complicated in RABL!
class StringsController < ApplicationController
def index
render json: ['my','array','of','strings']
end
end