Method: AbstractController::Callbacks::ClassMethods#_insert_callbacks

Defined in:
actionpack/lib/abstract_controller/callbacks.rb

#_insert_callbacks(callbacks, block = nil) ⇒ Object

Take callback names and an optional callback proc, normalize them, then call the block with each callback. This allows us to abstract the normalization across several methods that use it.

#### Parameters

  • callbacks - An array of callbacks, with an optional options hash as the last parameter.

  • block - A proc that should be added to the callbacks.

#### Block Parameters

  • name - The callback to be added.

  • options - A hash of options to be used when adding the callback.



120
121
122
123
124
125
126
127
128
129
# File 'actionpack/lib/abstract_controller/callbacks.rb', line 120

def _insert_callbacks(callbacks, block = nil)
  options = callbacks.extract_options!
  callbacks.push(block) if block
  options[:filters] = callbacks
  _normalize_callback_options(options)
  options.delete(:filters)
  callbacks.each do |callback|
    yield callback, options
  end
end