Class | ActionDispatch::Callbacks |
In: |
lib/action_dispatch/middleware/callbacks.rb
|
Parent: | Object |
Provide callbacks to be executed before and after the request dispatch.
It also provides a to_prepare callback, which is performed in all requests in development by only once in production and notification callback for async operations.
Add a preparation callback. Preparation callbacks are run before every request in development mode, and before the first request in production mode.
If a symbol with a block is given, the symbol is used as an identifier. That allows to_prepare to be called again with the same identifier to replace the existing callback. Passing an identifier is a suggested practice if the code adding a preparation block may be reloaded.