Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Document how the :include option can be used in Calculations::calcula…
…te. Closes #7446 [adamwiggins, ultimoamore]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8306 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
Marcel Molina committed Dec 5, 2007
1 parent aa9ed40 commit ee6b607
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*

* Document how the :include option can be used in Calculations::calculate. Closes #7446 [adamwiggins, ultimoamore]

* Fix typo in documentation for polymorphic associations w/STI. Closes #7461 [johnjosephbachir]

* Reveal that the type option in migrations can be any supported column type for your database but also include caveat about agnosticism. Closes #7531 [adamwiggins, mikong]
Expand Down
2 changes: 2 additions & 0 deletions activerecord/lib/active_record/calculations.rb
Expand Up @@ -20,6 +20,7 @@ module ClassMethods
# 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.
Expand Down Expand Up @@ -98,6 +99,7 @@ def sum(column_name, options = {})
#
# 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).
Expand Down

0 comments on commit ee6b607

Please sign in to comment.