instance method
run_callbacks
Ruby on Rails 4.1.16
Since v2.2.3Signature
run_callbacks(kind, &block)
Runs the callbacks for the given event.
Calls the before and around callbacks in the order they were set, yields the block (if given one), and then runs the after callbacks in reverse order.
If the callback chain was halted, returns false. Otherwise returns the result of the block, or true if no block is given.
run_callbacks :save do save end
Parameters
-
kindreq -
blockblock
Source
# File activesupport/lib/active_support/callbacks.rb, line 79
def run_callbacks(kind, &block)
cbs = send("_#{kind}_callbacks")
if cbs.empty?
yield if block_given?
else
runner = cbs.compile
e = Filters::Environment.new(self, false, nil, block)
runner.call(e).value
end
end
Defined in activesupport/lib/active_support/callbacks.rb line 79
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Callbacks