diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-10-16 22:13:06 +0200 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-10-16 22:13:06 +0200 |
commit | 9cb5400871b660e2c6d1654346650f07bb52a0c0 (patch) | |
tree | 6cd292650cf80b25494cf2f800318f337517b732 /activerecord | |
parent | 517bc500ed95a84fd2aadff34fdc14cb7965bc6b (diff) | |
download | rails-9cb5400871b660e2c6d1654346650f07bb52a0c0.tar.gz rails-9cb5400871b660e2c6d1654346650f07bb52a0c0.tar.bz2 rails-9cb5400871b660e2c6d1654346650f07bb52a0c0.zip |
Merge docrails
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 3 | ||||
-rw-r--r-- | activerecord/lib/active_record/callbacks.rb | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 6a1a3794a2..039e14435f 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -514,7 +514,7 @@ module ActiveRecord #:nodoc: # # ==== Parameters # - # * <tt>:conditions</tt> - An SQL fragment like "administrator = 1" or <tt>[ "user_name = ?", username ]</tt>. See conditions in the intro. + # * <tt>:conditions</tt> - An SQL fragment like "administrator = 1", <tt>[ "user_name = ?", username ]</tt>, or <tt>["user_name = :user_name", { :user_name => user_name }]</tt>. See conditions in the intro. # * <tt>:order</tt> - An SQL fragment like "created_at DESC, name". # * <tt>:group</tt> - An attribute name by which the result should be grouped. Uses the <tt>GROUP BY</tt> SQL-clause. # * <tt>:limit</tt> - An integer determining the limit on the number of rows that should be returned. @@ -551,6 +551,7 @@ module ActiveRecord #:nodoc: # # find first # Person.find(:first) # returns the first object fetched by SELECT * FROM people # Person.find(:first, :conditions => [ "user_name = ?", user_name]) + # Person.find(:first, :conditions => [ "user_name = :u", { :u => user_name }]) # Person.find(:first, :order => "created_on DESC", :offset => 5) # # # find last diff --git a/activerecord/lib/active_record/callbacks.rb b/activerecord/lib/active_record/callbacks.rb index dd7ae51096..42bfe34505 100644 --- a/activerecord/lib/active_record/callbacks.rb +++ b/activerecord/lib/active_record/callbacks.rb @@ -5,7 +5,7 @@ module ActiveRecord # before or after an alteration of the object state. This can be used to make sure that associated and # dependent objects are deleted when +destroy+ is called (by overwriting +before_destroy+) or to massage attributes # before they're validated (by overwriting +before_validation+). As an example of the callbacks initiated, consider - # the <tt>Base#save</tt> call: + # the <tt>Base#save</tt> call for a new record: # # * (-) <tt>save</tt> # * (-) <tt>valid</tt> @@ -22,7 +22,8 @@ module ActiveRecord # * (8) <tt>after_save</tt> # # That's a total of eight callbacks, which gives you immense power to react and prepare for each state in the - # Active Record lifecycle. + # Active Record lifecycle. The sequence for calling <tt>Base#save</tt> an existing record is similar, except that each + # <tt>_on_create</tt> callback is replaced by the corresponding <tt>_on_update</tt> callback. # # Examples: # class CreditCard < ActiveRecord::Base |