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.



10
11
12
# File 'lib/action_dispatch/middleware/actionable_exceptions.rb', line 10

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



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

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