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 invalidate RABL cache when updating your rabl view

I'm using the following rabl option config.cache_all_output = true This uses the default cache key for each object. The problem is, when I want to add or remove an element from the RABL view, this doesn't invalidate the cache so I continue to get…
jfeust
  • 845
  • 1
  • 9
  • 19
0
votes
2 answers

Rails 3 : Generate view using rabl

In my Rails Application i have Two instance variables @departments and @register @departments = { "users": [ { "departmentid": "DP11" }, { "departmentid": "DP12" }, { …
Cyber
  • 4,844
  • 8
  • 41
  • 61
0
votes
1 answer

Store output from RABL as ActiveRecord attribute

I need to store a JSON object as an ActiveRecord attribute after rendered using a RABL template. How can I do this? A simple example would be MyModel.my_data =
Ashan
  • 18,898
  • 4
  • 47
  • 67
0
votes
2 answers

Does RABL's JSON output not conform to standard? Can it?

So I have a very simple rabl view that will support output for both xml and json (curr.rabl): collection @currencies => "currencies" attributes :code, :name My rabl config: Rabl.configure do |config| config.include_json_root = false …
willard
  • 252
  • 3
  • 10
0
votes
1 answer

Understanding APIs

I was reading through the RABL git https://github.com/nesquena/rabl and I quickly came across this line. Can someone quickly explain what he means by "generating APIs"? When using the ActiveRecord 'to_json' method, I tend to quickly find myself…
1dolinski
  • 479
  • 3
  • 9
  • 29
0
votes
1 answer

Is there a way to make a custom root node in a RABL feed?

I'm working on a RABL JSON feed and I'd like to make a custom root node where I can link to a particular object. I have the object declared like so: object @event Here is the beginning of the output: { - event: { id: 131, I'd like to have…
Jack
  • 1,125
  • 1
  • 13
  • 29
0
votes
1 answer

rabl wrap collection in json object

I am using RABL to generate JSON responses. I am having trouble achieving the following structure: { "articles": [ { "created_at": "2012-10-20T15:57:31Z", "description": "MK DEsc", "id": 1, "title": "MK…
DArkO
  • 15,880
  • 12
  • 60
  • 88
0
votes
1 answer

passing an object to render( :template => "template.json.rabl") in RoR 3

I need to embed json into html and in the #322 RailsCasts says the way to do it using RABL... app/views/places/show.html.erb
" > here is my rabl…
figuedmundo
  • 375
  • 1
  • 4
  • 15
0
votes
1 answer

Embedding JSON into HTML with Rails3 and Rabl

I'm following the #322 RailsCasts and in the last part he comments a way to embebed json into html
" > In my project I have a rabl template:…
figuedmundo
  • 375
  • 1
  • 4
  • 15
0
votes
1 answer

Upgrading Rails 2.3.2 to Rails 2.3.14

I've been given the responsibility of a fairly large legacy Rails 2.3.2 app and I've been asked to add a reasonably complex RESTful API to this app that outputs data in JSON. After doing my research, I've come to the conclusion that using the RABL…
richard
  • 1,565
  • 2
  • 18
  • 35
0
votes
1 answer

How to customize JSON response from Rails app using Rabl gem

In my rails API app Im using the Rabl gem to render JSON. However, I ned the JSON to be in a specific format. This is the JSON my rails app is sending as a response : [{"lat":"49.2505","lng":"-123.1119"},{"lat":"49.2515","lng":"-123.1109"}] This…
banditKing
  • 9,405
  • 28
  • 100
  • 157
0
votes
1 answer

Using versioning in a Rails API app- Cannot render JSON for a particular controller action

I created a practice rails app where I have created a namespace and versioned like is demonstrated in this railscast. Everything is working fine and I can see the json output in the browser Then I added the Rabl gem and was trying to render the rabl…
banditKing
  • 9,405
  • 28
  • 100
  • 157
0
votes
1 answer

Rabl and doorkeeper

I develop api for my rails project and don't now how to solve this problem I use doorkeeper gem for authentication and rabl gem for json rendering. And i have to add some fields only for logged user. For example: part of show.rabl: node…
caulfield
  • 1,383
  • 1
  • 11
  • 21
0
votes
1 answer

how to: Rails respond_to json using exact same rabl template?

I am have two actions of which renders eventually should output json using the same rabl template, but at the moment, they each have a template with their own name dashboard.json.rabl and batch_create.json.rabl they are the exact same, how can I…
Nik So
  • 16,683
  • 21
  • 74
  • 108
0
votes
1 answer

properly formatting object to json with RABL

I have an array @user_designs which has a few attributes, including name, theme_id, and token. Currently my RABL looks like this: collection @user_designs attributes :token, :name, :theme_id and displays this: [ { "user_design":…
Zyren
  • 603
  • 2
  • 7
  • 21
1 2 3
19
20