Class: Apiarist::ResourceController::Responder

Inherits:
ActionController::Responder
  • Object
show all
Defined in:
lib/apiarist/resource_controller/responder.rb

Instance Method Summary collapse

Instance Method Details

#display(resource, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/apiarist/resource_controller/responder.rb', line 9

def display(resource, options = {})
  if resource.respond_to?(:each)
    root = resource_class.name.underscore.pluralize
  else
    root = resource_class.name.underscore
  end

  super({root => serialize(resource, scope: _serialization_scope)}, options)
end