From ec6089995d456c91aadf1cb2324b2e626016975c Mon Sep 17 00:00:00 2001 From: Fabian Schwahn Date: Tue, 18 Jul 2017 16:57:57 +0200 Subject: Improve documentation of Procs as :if / :unless options for callbacks --- activesupport/lib/active_support/callbacks.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index c266b432c0..487fe79f41 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -657,9 +657,17 @@ module ActiveSupport # * :if - A symbol or an array of symbols, each naming an instance # method or a proc; the callback will be called only when they all return # a true value. + # + # If a proc is given, its body is evaluated in the context of the + # current object. It can also optionally accept the current object as + # an argument. # * :unless - A symbol or an array of symbols, each naming an # instance method or a proc; the callback will be called only when they # all return a false value. + # + # If a proc is given, its body is evaluated in the context of the + # current object. It can also optionally accept the current object as + # an argument. # * :prepend - If +true+, the callback will be prepended to the # existing chain rather than appended. def set_callback(name, *filter_list, &block) -- cgit v1.2.3