Class: ActionDispatch::ActionableExceptions

Inherits:
Object
  • Object
show all
Defined in:
lib/action_dispatch/middleware/actionable_exceptions.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ActionableExceptions

Returns a new instance of ActionableExceptions.



12
13
14
# File 'lib/action_dispatch/middleware/actionable_exceptions.rb', line 12

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/action_dispatch/middleware/actionable_exceptions.rb', line 16

def call(env)
  request = ActionDispatch::Request.new(env)
  return @app.call(env) unless actionable_request?(request)

  ActiveSupport::ActionableError.dispatch(request.params[:error].to_s.safe_constantize, request.params[:action])

  redirect_to request.params[:location]
end