Module: ResourceFull::Render

Includes:
HTML, JSON, XML
Defined in:
lib/resource_full/render.rb,
lib/resource_full/render/xml.rb,
lib/resource_full/render/html.rb,
lib/resource_full/render/json.rb

Defined Under Namespace

Modules: HTML, JSON, XML

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(controller) ⇒ Object



7
8
9
# File 'lib/resource_full/render.rb', line 7

def self.included(controller)
  controller.rescue_from Exception, :with => :handle_generic_exception_with_correct_response_format
end

Instance Method Details

#http_error_code_for(errors) ⇒ Object

Override this method to provide custom error handling for the errors generated by your model object.



13
14
15
16
17
# File 'lib/resource_full/render.rb', line 13

def http_error_code_for(errors)
  if errors.any? { |message| message.include? CONFLICT_MESSAGE }
    :conflict
  else :unprocessable_entity end
end