Skip to Content Skip to Search

class ActionDispatch::Callbacks

Action Dispatch Callbacks

Provides callbacks to be executed before and after dispatching the request.

Inherits From

Public class methods

after(*args, &block)

Permalink
Source code GitHub
# File actionpack/lib/action_dispatch/middleware/callbacks.rb, line 17
def after(*args, &block)
  set_callback(:call, :after, *args, &block)
end

before(*args, &block)

Permalink
Source code GitHub
# File actionpack/lib/action_dispatch/middleware/callbacks.rb, line 13
def before(*args, &block)
  set_callback(:call, :before, *args, &block)
end

new(app)

Permalink
Source code GitHub
# File actionpack/lib/action_dispatch/middleware/callbacks.rb, line 22
def initialize(app)
  @app = app
end

Public instance methods

call(env)

Permalink
Source code GitHub
# File actionpack/lib/action_dispatch/middleware/callbacks.rb, line 26
def call(env)
  error = nil
  result = run_callbacks :call do
    @app.call(env)
  rescue => error
  end
  raise error if error
  result
end

Definition files