Class: Roar::Rails::Responder

Inherits:
ActionController::Responder
  • Object
show all
Includes:
PrepareModel, VersionStrategy
Defined in:
lib/roar/rails/responder.rb,
lib/roar/rails/rails3_0_strategy.rb,
lib/roar/rails/rails3_1_strategy.rb,
lib/roar/rails/rails3_2_strategy.rb,
lib/roar/rails/rails4_0_strategy.rb,
lib/roar/rails/rails4_2_strategy.rb,
lib/roar/rails/rails5_0_strategy.rb

Defined Under Namespace

Modules: PrepareModel, VersionStrategy Classes: Response

Instance Method Summary collapse

Methods included from VersionStrategy

#prepare_model_for

Methods included from PrepareModel

#prepare_model_for

Instance Method Details

#display(model, *args) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/roar/rails/responder.rb', line 4

def display(model, *args)
  if represent_format?
    handle_lonely_collection!(model) and return super # :represent_items_with

    model = prepare_model_for(format, model, options)
  end

  super(create_response(model), *args) # AC::Responder: this calls controller.render which calls render_to_body which calls renderer[:json] which calls model.to_json.
end