a rails3 example app that demonstrates how to use RABL gem
Ruby JavaScript
Switch branches/tags
Nothing to show
Latest commit 2b03639 Sep 21, 2011 @teohm fixing fixture data
Permalink
Failed to load latest commit information.
app
config
db
doc
lib
log
public
script
test
vendor
.gitignore
Gemfile
Gemfile.lock
README.md
Rakefile
config.ru

README.md

RABL - an intro

fork me

git clone https://github.com/teohm/event-api

problem?

When building a non-trivial web API, you may notice it is difficult use to_json or as_json to serialize model into JSON:

http://engineering.gomiso.com/2011/05/16/if-youre-using-to_json-youre-doing-it-wrong/

rabl - ruby api builder language

RABL provides a simple DSL to generate JSON/XML from model.

See https://github.com/nesquena/rabl

demo - event management app

3 models: User, Event, EventGuest

# To load sample data
bundle exec rake db:migrate:reset
bundle exec rake db:fixtures:load

1. use extends to reuse

2. use child to add more fields

3. use glue to attach child fields directly to parent