Class: RestfulError::ExceptionsController

Inherits:
ActionController::Metal
  • Object
show all
Includes:
AbstractController::Rendering, ActionView::Layouts
Defined in:
lib/restful_error/railtie.rb

Instance Method Summary collapse

Instance Method Details

#showObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/restful_error/railtie.rb', line 11

def show
  @exception = request.env["action_dispatch.exception"]
  code = request.path_info[1..].to_i
  status = RestfulError.build_status_from_symbol_or_code(code)
  @status_code = status.code
  @reason_phrase = status.reason_phrase
  @response_message = @exception.try(:response_message) || RestfulError.localized_phrase(@exception.class.name, status) || nil

  self.status = status.code
  render "restful_error/show", formats: request.format.symbol
end