Skip to content
This repository
Browse code

adding to the :kind documentation for ActiveSupport callbacks

  • Loading branch information...
commit e4c8bc1b34867edccf3f515423fab19fae867b4f 1 parent ed9a183
Neeraj Singh authored June 14, 2010
5  activesupport/lib/active_support/callbacks.rb
@@ -565,6 +565,11 @@ def reset_callbacks(symbol)
565 565
       #  passed. In the above case method "before_save" is constructed by calling "#{kind}_#{name}" 
566 566
       #  in the given class. In this case "kind" is "before" and "name" is "save".
567 567
       #
  568
+      #  Although ":kind" is the default scope that is passed, it is possible to not to make use of ":kind".
  569
+      #  define_callbacks :save, :scope => [:name] . A declaration like this would call "save" method of
  570
+      #  Audit class since ":kind" is skipped.
  571
+      #
  572
+      #
568 573
       def define_callbacks(*callbacks)
569 574
         config = callbacks.last.is_a?(Hash) ? callbacks.pop : {}
570 575
         callbacks.each do |callback|

0 notes on commit e4c8bc1

Please sign in to comment.
Something went wrong with that request. Please try again.