apotonick/roar-rails — pull request #50 by guiocavalcanti (2013-08-18 19:34:55+00:00)
Title: Representer rails generator

Make it possible to create representers with rails generators. This is related to #15.

Usage:

```
rails g representer Band id name

This will create a representer as follows:

module BandRepresenter
include Roar::Representer::JSON

property :id
property :name
end

You can pass :class and :extend property options:

rails g singer id instrument:equipament:instrument_representer

This will add property options:

module SingerRepresenter
include Roar::Representer::JSON

property :id
property :instrument, :class => Equipament, :extend => InstrumentRepresenter
end

You can also choose representer format with --format option

rails g representer Band id name --format=xml

module BandRepresenter
include Roar::Representer::XML

property :id
property :name
end
```