instance method
_insert_callbacks
Ruby on Rails 4.0.13
Since v3.0.20Signature
_insert_callbacks(callbacks, block = nil)
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
Parameters
-
callbacksreq -
blockopt = nil
Source
# File actionpack/lib/abstract_controller/callbacks.rb, line 71
def _insert_callbacks(callbacks, block = nil)
options = callbacks.last.is_a?(Hash) ? callbacks.pop : {}
_normalize_callback_options(options)
callbacks.push(block) if block
callbacks.each do |callback|
yield callback, options
end
end
Defined in actionpack/lib/abstract_controller/callbacks.rb line 71
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in AbstractController::Callbacks::ClassMethods