Questions tagged [rabl]

RABL (Ruby API Builder Language) is a Ruby templating system for generating XML and JSON.

RABL (Ruby API Builder Language) is a Ruby templating system for generating XML and JSON.

294 questions
0
votes
1 answer

How to filter the result in a view generated by RABL

I'm using RABL to render JSON. I have these models: Project Task User The "show project" action should result in rendering of the details of the project including a list of the Tasks in the Project, but only those who the user is permitted to…
davidrac
  • 10,723
  • 3
  • 39
  • 71
0
votes
1 answer

How to have two pieces of data output as json in rabl

New to rabl and not sure how to do this with two different arrays returned in a single hash like this: @data={:locations => [location1, location2], :items => [item1,item2]} In my rabl file, I'd like to do something like the…
timpone
  • 19,235
  • 36
  • 121
  • 211
0
votes
1 answer

How can I consume a RABL API from within the application?

I'm working on exposing an API using RABL. Exposing the views is easy enough, but I've run into trouble having my own application consume those views. For example, assume I have an endpoint at http://example.com/api/articles, which produces a JSON…
Josh Leitzel
  • 15,089
  • 13
  • 59
  • 76
0
votes
1 answer

How can I make RABL render an attribute only if it exists in the object?

I have a RESTful User model and am trying to filter attributes to be included in the Show JSON response when the User object being sought is not the current user. Logic: if params[:id]==current_user json => {:name: , :birthdate:…
T C
  • 1,337
  • 1
  • 12
  • 21
0
votes
1 answer

Rabl return string Rails

In my controller I have app_key = Application.find_by_name(params[:id].capitalize).app_key @response = app_key == params[:app_key] ? "200" : "403" I would like to return response : "response" => @response , how to do it using Rabl in Rails??
Michał Makaruk
  • 283
  • 1
  • 2
  • 8
0
votes
1 answer

handling 2 different types with rabl

I am doing a search against a table called locations and a table called items. They are both short tables (2k items) so not nervous about performance of this query. I am going to search against one and then another and thus return 2 different types…
timpone
  • 19,235
  • 36
  • 121
  • 211
-1
votes
1 answer

RABL - child not loading

I am having a beast of a time with setting childs using RABL with ruby on rails I was originally trying some examples in the show.rabl file i saw on the railscast #322 to get child table as a nested node on my json output. show.json.rabl: object…
Jay Rizzi
  • 4,196
  • 5
  • 42
  • 71
-1
votes
1 answer

RABL collection date format

I Want to return the datetime of the updated_at attribute in another format, but, in a collection. If it was a single object, I'll do something like object @person attributes :name, :phone …
caarlos0
  • 20,020
  • 27
  • 85
  • 160
-1
votes
1 answer

Rendering child nodes without the node label in rabl

I am using rabl to build and API in Sinatra. The required JSON des not accept labels in some nodes Using this Rabl template: object @user attributes :profile_photo => :profile_photo, :name => :first_name, :last_name => :last_name child…
cobi_z
  • 87
  • 4
1 2 3
19
20