diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-07-08 00:52:37 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-07-08 00:52:37 +0000 |
commit | 1060fe2d723cc2ce4b3bfff308eab5360090c595 (patch) | |
tree | caa033a823bb5b813eb2e4a665eb91a28bc14f54 /activerecord/lib/active_record | |
parent | 7767e33b4320231b8cdff48c36f180381370e585 (diff) | |
download | rails-1060fe2d723cc2ce4b3bfff308eab5360090c595.tar.gz rails-1060fe2d723cc2ce4b3bfff308eab5360090c595.tar.bz2 rails-1060fe2d723cc2ce4b3bfff308eab5360090c595.zip |
Update callbacks documentation. Closes #3970.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4585 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/callbacks.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index 950113c076..bfe96fd2ed 100755 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -232,6 +232,10 @@ module ActiveRecord def before_save() end # Is called _after_ Base.save (regardless of whether it's a create or update save). + # + # class Contact < ActiveRecord::Base + # after_save { logger.info( 'New contact saved!' ) } + # end def after_save() end def create_or_update_with_callbacks #:nodoc: return false if callback(:before_save) == false @@ -301,9 +305,16 @@ module ActiveRecord end # Is called _before_ Base.destroy. + # + # Note: If you need to _destroy_ or _nullify_ associated records first, + # use the _:dependent_ option on your associations. def before_destroy() end # Is called _after_ Base.destroy (and all the attributes have been frozen). + # + # class Contact < ActiveRecord::Base + # after_destroy { |record| logger.info( "Contact #{record.id} was destroyed." ) } + # end def after_destroy() end def destroy_with_callbacks #:nodoc: return false if callback(:before_destroy) == false |