Class: ActionDispatch::ActionableExceptions

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ActionableExceptions

Returns a new instance of ActionableExceptions.



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

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



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

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