Module: Trailblazer::V1_1::Operation::Representer::Rendering

Included in:
Trailblazer::V1_1::Operation::Representer
Defined in:
lib/trailblazer/1.1/operation/representer.rb

Instance Method Summary collapse

Instance Method Details

#representedObject

Override this if you want to render something else, e.g. the contract.


69
70
71
# File 'lib/trailblazer/1.1/operation/representer.rb', line 69

def represented
  model
end

#to_json(options = {}) ⇒ Object

Override this if you need to pass options to the rendering.

def to_json(*)
  super(include: @params[:include])
end

64
65
66
# File 'lib/trailblazer/1.1/operation/representer.rb', line 64

def to_json(options={})
  self.class.representer_class.new(represented).to_json(options)
end