diff options
author | Jesse Storimer <jstorimer@gmail.com> | 2011-01-28 23:23:39 -0500 |
---|---|---|
committer | Jesse Storimer <jstorimer@gmail.com> | 2011-01-28 23:40:42 -0500 |
commit | 38d31b0ef0b9c9616918819b5ac5b9d21c539fd7 (patch) | |
tree | 90513057983fee2d70ea3192d73eddff229823a6 /activerecord/lib/active_record | |
parent | 38d728fb944b08b7faabf19c8ba5ef2e69e29c16 (diff) | |
download | rails-38d31b0ef0b9c9616918819b5ac5b9d21c539fd7.tar.gz rails-38d31b0ef0b9c9616918819b5ac5b9d21c539fd7.tar.bz2 rails-38d31b0ef0b9c9616918819b5ac5b9d21c539fd7.zip |
Correct docs for after_find and after_initialize
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/callbacks.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index 47428cfd0f..64ffcb11fe 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -25,7 +25,11 @@ module ActiveRecord # Check out <tt>ActiveRecord::Transactions</tt> for more details about <tt>after_commit</tt> and # <tt>after_rollback</tt>. # - # That's a total of ten callbacks, which gives you immense power to react and prepare for each state in the + # Lastly an <tt>after_find</tt> and <tt>after_initialize</tt> callback is triggered for each object that + # is found and instantiated by a finder, with <tt>after_initialize</tt> being triggered after new objects + # are instantiated as well. + # + # That's a total of twelve callbacks, which gives you immense power to react and prepare for each state in the # Active Record life cycle. The sequence for calling <tt>Base#save</tt> for an existing record is similar, # except that each <tt>_on_create</tt> callback is replaced by the corresponding <tt>_on_update</tt> callback. # @@ -185,14 +189,6 @@ module ActiveRecord # 'puts "Evaluated after parents are destroyed"' # end # - # == The +after_find+ and +after_initialize+ exceptions - # - # Because +after_find+ and +after_initialize+ are called for each object found and instantiated by a finder, - # such as <tt>Base.find(:all)</tt>, we've had to implement a simple performance constraint (50% more speed - # on a simple test case). Unlike all the other callbacks, +after_find+ and +after_initialize+ will only be - # run if an explicit implementation is defined (<tt>def after_find</tt>). In that case, all of the - # callback types will be called. - # # == <tt>before_validation*</tt> returning statements # # If the returning value of a +before_validation+ callback can be evaluated to +false+, the process will be |