From 9cb5400871b660e2c6d1654346650f07bb52a0c0 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Thu, 16 Oct 2008 22:13:06 +0200 Subject: Merge docrails --- activerecord/lib/active_record/base.rb | 3 ++- activerecord/lib/active_record/callbacks.rb | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'activerecord/lib') 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 # - # * :conditions - An SQL fragment like "administrator = 1" or [ "user_name = ?", username ]. See conditions in the intro. + # * :conditions - An SQL fragment like "administrator = 1", [ "user_name = ?", username ], or ["user_name = :user_name", { :user_name => user_name }]. See conditions in the intro. # * :order - An SQL fragment like "created_at DESC, name". # * :group - An attribute name by which the result should be grouped. Uses the GROUP BY SQL-clause. # * :limit - 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 Base#save call: + # the Base#save call for a new record: # # * (-) save # * (-) valid @@ -22,7 +22,8 @@ module ActiveRecord # * (8) after_save # # 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 Base#save an existing record is similar, except that each + # _on_create callback is replaced by the corresponding _on_update callback. # # Examples: # class CreditCard < ActiveRecord::Base -- cgit v1.2.3