Sha256: e5a6149ada0e7a910d90214268f4d7bd419debbbdeddffeb380c362fd2d149dd

Contents?: true

Size: 882 Bytes

Versions: 3

Compression:

Stored size: 882 Bytes

Contents

Description:
  Creates a new Representer and its properties.

  This generates a representer module in app/representers directory.

Examples:

  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 => Equipment, :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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
roar-rails-1.0.0 lib/generators/rails/USAGE
roar-rails-0.1.6 lib/generators/rails/USAGE
roar-rails-0.1.5 lib/generators/rails/USAGE