Sha256: 508e44f6e80d14576f634e34afc02ce5596970cbfbcb216613ce4bd5b7d70083

Contents?: true

Size: 883 Bytes

Versions: 1

Compression:

Stored size: 883 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 => 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roar-rails-0.1.4 lib/generators/rails/USAGE