aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/callbacks.rb
diff options
context:
space:
mode:
authorRyan Bigg <radarlistener@gmail.com>2009-07-16 07:52:49 +1000
committerRyan Bigg <radarlistener@gmail.com>2009-07-16 07:52:49 +1000
commit00d899e11ff9f16af6900d944e29a14ab1138463 (patch)
tree9661929a4ea8be5fa6e5ff97f514ab4c645c50cd /activerecord/lib/active_record/callbacks.rb
parentbb8fb2d143dad0e4334ac9c83f5c03b1eb5473c8 (diff)
downloadrails-00d899e11ff9f16af6900d944e29a14ab1138463.tar.gz
rails-00d899e11ff9f16af6900d944e29a14ab1138463.tar.bz2
rails-00d899e11ff9f16af6900d944e29a14ab1138463.zip
More documentation about methods taking blocks.
Diffstat (limited to 'activerecord/lib/active_record/callbacks.rb')
-rw-r--r--activerecord/lib/active_record/callbacks.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb
index 97bb7f664d..cf484507e9 100644
--- a/activerecord/lib/active_record/callbacks.rb
+++ b/activerecord/lib/active_record/callbacks.rb
@@ -276,11 +276,19 @@ module ActiveRecord
private :create_with_callbacks
# Is called _before_ <tt>Base.save</tt> on existing objects that have a record.
+ #
+ # class Contact < ActiveRecord::Base
+ # before_update { |record| logger.info( "Contact #{record.id} is about to be updated." ) }
+ # end
def before_update() end
# Is called _after_ <tt>Base.save</tt> on existing objects that have a record.
# Note that this callback is still wrapped in the transaction around +save+. For example, if you
# invoke an external indexer at this point it won't see the changes in the database.
+ #
+ # class Contact < ActiveRecord::Base
+ # after_update { |record| logger.info( "Contact #{record.id} was updated." ) }
+ # end
def after_update() end
def update_with_callbacks(*args) #:nodoc:
@@ -330,6 +338,10 @@ module ActiveRecord
#
# Note: If you need to _destroy_ or _nullify_ associated records first,
# use the <tt>:dependent</tt> option on your associations.
+ #
+ # class Contact < ActiveRecord::Base
+ # after_destroy { |record| logger.info( "Contact #{record.id} is about to be destroyed." ) }
+ # end
def before_destroy() end
# Is called _after_ <tt>Base.destroy</tt> (and all the attributes have been frozen).