Sha256: 36ce82f7791ac73780e8bf9bc9ad5ac5bba918e4d7b88adc60b3fa1ab75eb951

Contents?: true

Size: 842 Bytes

Versions: 5

Compression:

Stored size: 842 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::JSON

    property :id
    property :name
  end

  You can pass :class and :extend property options:

    rails g singer id instrument:equipment:instrument_representer

  This will add property options:

    module SingerRepresenter
      include Roar::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::XML

    property :id
    property :name
  end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/roar-rails-1.2.0/lib/generators/rails/USAGE
roar-rails-1.2.0 lib/generators/rails/USAGE
roar-rails-1.1.0 lib/generators/rails/USAGE
roar-rails-1.0.2 lib/generators/rails/USAGE
roar-rails-1.0.1 lib/generators/rails/USAGE