Class: Intermodal::LinkingResourceResponder

Inherits:
ResourceResponder
  • Object
show all
Defined in:
lib/intermodal/responders/linking_resource_responder.rb

Instance Attribute Summary

Attributes inherited from ResourceResponder

#options

Instance Method Summary collapse

Methods inherited from ResourceResponder

#initialize

Constructor Details

This class inherits a constructor from Intermodal::ResourceResponder

Instance Method Details

#respondObject

This is the common behavior for “API” requests, like :xml and :json.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/intermodal/responders/linking_resource_responder.rb', line 7

def respond
  if get?
    display resource, :root => presentation_root
  elsif has_errors?
    display resource.errors, :status => :unprocessable_entity
  elsif post?
    display resource, :status => :created
      #:location => api_location # Taken out because it requires some additional URL definitions
  else
    head :ok
  end
end