class method self.to_prepare

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

self.to_prepare(identifier = nil, &block)

Add a preparation callback. Preparation callbacks are run before every request in development mode, and before the first request in production mode.

An optional identifier may be supplied for the callback. If provided, to_prepare may 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.

Parameters

identifier opt = nil
block block
Source
# File actionpack/lib/action_controller/dispatcher.rb, line 52
      def to_prepare(identifier = nil, &block)
        @prepare_dispatch_callbacks ||= ActiveSupport::Callbacks::CallbackChain.new
        callback = ActiveSupport::Callbacks::Callback.new(:prepare_dispatch, block, :identifier => identifier)
        @prepare_dispatch_callbacks.replace_or_append!(callback)
      end

Defined in actionpack/lib/action_controller/dispatcher.rb line 52 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Dispatcher

Type at least 2 characters to search.

↑↓ navigate · open · esc close