Action Dispatch Callbacks

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

Methods

Included Modules

Class Public methods

after(*args, &block)

📝 Source code
# File actionpack/lib/action_dispatch/middleware/callbacks.rb, line 19
      def after(*args, &block)
        set_callback(:call, :after, *args, &block)
      end
🔎 See on GitHub

before(*args, &block)

📝 Source code
# File actionpack/lib/action_dispatch/middleware/callbacks.rb, line 15
      def before(*args, &block)
        set_callback(:call, :before, *args, &block)
      end
🔎 See on GitHub

new(app)

📝 Source code
# File actionpack/lib/action_dispatch/middleware/callbacks.rb, line 24
    def initialize(app)
      @app = app
    end
🔎 See on GitHub

Instance Public methods

call(env)

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