aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2007-12-05 20:51:03 +0000
committerMarcel Molina <marcel@vernix.org>2007-12-05 20:51:03 +0000
commitee6b6073d50799547e9dcbe1aaeacb8976243e48 (patch)
tree7e19abd08e1ca1ded2d25759e6395f5acf77151f /activerecord/lib/active_record
parentaa9ed408a870bd31e1fcc669d877b8612cae0e08 (diff)
downloadrails-ee6b6073d50799547e9dcbe1aaeacb8976243e48.tar.gz
rails-ee6b6073d50799547e9dcbe1aaeacb8976243e48.tar.bz2
rails-ee6b6073d50799547e9dcbe1aaeacb8976243e48.zip
Document how the :include option can be used in Calculations::calculate. Closes #7446 [adamwiggins, ultimoamore]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8306 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/calculations.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb
index df73cee2f3..7a9377587f 100644
--- a/activerecord/lib/active_record/calculations.rb
+++ b/activerecord/lib/active_record/calculations.rb
@@ -20,6 +20,7 @@ module ActiveRecord
# If the value is a string, then the records will be returned read-only since they will have attributes that do not correspond to the table's columns.
# Pass :readonly => false to override.
# See adding joins for associations under Associations.
+ #
# * <tt>:include</tt>: Named associations that should be loaded alongside using LEFT OUTER JOINs. The symbols named refer
# to already defined associations. When using named associations, count returns the number of DISTINCT items for the model you're counting.
# See eager loading under Associations.
@@ -98,6 +99,7 @@ module ActiveRecord
#
# Options:
# * <tt>:conditions</tt> - An SQL fragment like "administrator = 1" or [ "user_name = ?", username ]. See conditions in the intro.
+ # * <tt>:include</tt>: Eager loading, see Associations for details. Since calculations don't load anything, the purpose of this is to access fields on joined tables in your conditions, order, or group clauses.
# * <tt>:joins</tt> - An SQL fragment for additional joins like "LEFT JOIN comments ON comments.post_id = id". (Rarely needed).
# The records will be returned read-only since they will have attributes that do not correspond to the table's columns.
# * <tt>:order</tt> - An SQL fragment like "created_at DESC, name" (really only used with GROUP BY calculations).