Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update callbacks documentation. #3970 [Robby Russell <robby@planetarg…

…on.com>] Merge doc patches with stable.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@4702 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 171aa5c4c1ede63335902b073a22d56ae9cbbf97 1 parent fc1ded4
Marcel Molina authored
View
2  activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*1.14.3* (June 27th, 2006)
+* Update callbacks documentation. #3970 [Robby Russell <robby@planetargon.com>]
+
* Properly quote index names in migrations (closes #4764) [John Long]
* Ensure that Associations#include_eager_conditions? checks both scoped and explicit conditions [Rick]
View
11 activerecord/lib/active_record/callbacks.rb
@@ -243,6 +243,10 @@ def initialize_with_callbacks(attributes = nil) #:nodoc:
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
@@ -312,9 +316,16 @@ def valid_with_callbacks #:nodoc:
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
Please sign in to comment.
Something went wrong with that request. Please try again.