diff options
author | Fabian Schwahn <fabian.schwahn@gmail.com> | 2017-07-18 16:57:57 +0200 |
---|---|---|
committer | Fabian Schwahn <fabian.schwahn@gmail.com> | 2018-08-20 11:44:31 +0200 |
commit | ec6089995d456c91aadf1cb2324b2e626016975c (patch) | |
tree | d49efdf5e9a584cce4608e058f556628ba3cef83 /activesupport | |
parent | 103b02f1524beaa5c773f95dce6892dad3805d4f (diff) | |
download | rails-ec6089995d456c91aadf1cb2324b2e626016975c.tar.gz rails-ec6089995d456c91aadf1cb2324b2e626016975c.tar.bz2 rails-ec6089995d456c91aadf1cb2324b2e626016975c.zip |
Improve documentation of Procs as :if / :unless options for callbacks
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 # * <tt>:if</tt> - 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. # * <tt>:unless</tt> - 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. # * <tt>:prepend</tt> - If +true+, the callback will be prepended to the # existing chain rather than appended. def set_callback(name, *filter_list, &block) |