aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/calculations.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge scoped :joins together instead of overwriting them. May expose scoping ↵Andrew White2008-08-281-1/+1
| | | | | | | | bugs in your code! [#501 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Alias included associations if needed when doing a countTarmo Tänav2008-08-271-2/+8
| | | | | | [#302 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Performance: reduce garbage created by ↵Joshua Peek2008-08-261-1/+8
| | | | ActiveRecord::Calculations#column_alias_for
* Alias subquery used in calculations, to provide better compatibility with ↵Michalis Polakis2008-08-111-1/+1
| | | | | | | | databases such as MonetDB Signed-off-by: Michael Koziarski <michael@koziarski.com> Signed-off-by: Tom Ward <tom@popdog.net> [#796 state:committed]
* Add :from option to calculations. [#397 state:resolved]Ben Munat2008-06-111-3/+9
|
* Ensure AR#sum result is typecasted properlyPratik Naik2008-06-021-2/+3
|
* Ensure Associations#sum returns 0 when no rows are returned. [#295 ↵Jonathan Viney2008-06-021-3/+3
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Merge docrails.Pratik Naik2008-05-251-10/+12
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Improve documentation coverage and markupXavier Noria2008-05-021-6/+6
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Avoid adding two DISTINCT statements to queries in sqlite 2.Frederick Cheung2008-04-211-1/+1
|
* ActiveRecord::Base#sum defaults to 0 if no rows are returned. Closes #11550 ↵Rick Olson2008-04-081-1/+1
| | | | | | [kamal] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9243 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Don't double include DISTINCT when the user has already specified it. ↵Michael Koziarski2008-04-041-1/+4
| | | | | | Closes #11502 [kenneth.kalmer] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9223 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure that you can still do expressions in calculations (closes #11355) ↵David Heinemeier Hansson2008-03-171-1/+2
| | | | | | [nbugajski/cavelle] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure that ActiveRecord::Calculations disambiguates field names with the ↵Rick Olson2008-03-131-0/+1
| | | | | | table name. Closes #11027 [cavalle] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9018 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix calculations on associations with custom :foreign_key. Closes #8117 ↵Jeremy Kemper2008-02-021-1/+1
| | | | | | [kamal, jack] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8778 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ruby 1.9 compat: calculations don't assume array implementation of ordered ↵Jeremy Kemper2007-12-271-1/+2
| | | | | | hash. References #1689 [Frederick Cheung] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8494 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove references to nonexistent :joins documentation. Closes #10498 [tpope]Marcel Molina2007-12-131-4/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8381 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Document how the :include option can be used in Calculations::calculate. ↵Marcel Molina2007-12-051-0/+2
| | | | | | Closes #7446 [adamwiggins, ultimoamore] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8306 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Smattering of grammatical fixes to documentation. Closes #10083 [BobSilva]Marcel Molina2007-11-081-10/+13
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8113 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Address shortcomings of changeset [8054] [protocool]David Heinemeier Hansson2007-11-071-15/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8109 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Standardize on using hyphens rather than colons to separate option names ↵Marcel Molina2007-11-061-6/+6
| | | | | | from their explanation in documentation. Replace + with tt tags. Closes #8732. [ryanb] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8106 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Escape table names during calculation queries. [wesley.moxam, Koz] Closes #4593Michael Koziarski2007-10-311-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8061 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Introduce finder :joins with associations. Same :include syntax but with ↵Jeremy Kemper2007-10-291-4/+15
| | | | | | inner rather than outer joins. Closes #10012. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8054 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix and properly document/test count(column_name) usage. Closes #8999 [lifofifo]Rick Olson2007-07-171-8/+14
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7192 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove deprecated count(conditions=nil, joins=nil) usage. Closes #8993 ↵Rick Olson2007-07-161-27/+10
| | | | | | [lifofifo] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7189 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Calculations support non-numeric foreign keys. Closes #8154.Jeremy Kemper2007-06-011-1/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6919 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Calculations: return nil average instead of 0 when there are no rows to ↵Jeremy Kemper2007-05-301-1/+1
| | | | | | average. Closes #8298. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6904 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* documentation project patches, closes #7342, #7319, #7316, #7190 ↵Rick Olson2007-03-271-2/+2
| | | | | | [jeremymcanally] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6470 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* SQLite: count(distinct) queries supported in >= 3.2.6, fix calculations ↵Jeremy Kemper2006-11-051-14/+21
| | | | | | workaround, remove count(distinct) query rewrite, cleanup test connection scripts. Closes #6544. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5426 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Include caller of deprecated count method.Jeremy Kemper2006-09-291-2/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5204 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Deprecation: count class method should be called with an options hash rather ↵Jeremy Kemper2006-09-261-14/+23
| | | | | | than two args for conditions and joins. Closes #6287. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5192 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that count distinct should use the selected column even when using ↵David Heinemeier Hansson2006-06-031-1/+1
| | | | | | :include (closes #5251) [anna@wota.jp] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4417 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Namespaced OrderedHash so the Rails implementation does not clash with any ↵Rick Olson2006-04-301-1/+1
| | | | | | others. (fixes #4911) [Julian Tarkhanov] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4318 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* When grouping, use the appropriate option key. [Marcel Molina Jr.]Marcel Molina2006-04-281-1/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4297 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add support for FrontBase (http://www.frontbase.com/) with a new adapter ↵Marcel Molina2006-04-271-2/+12
| | | | | | thanks to the hard work of one Mike Laster. Closes #4093. [mlaster@metavillage.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4291 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix bug where calculations with long alias names return null. [Rick]Rick Olson2006-04-251-4/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4269 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Allow all calculations to take the :include option, not just COUNT (closes ↵Rick Olson2006-04-251-34/+43
| | | | | | #4840) [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4264 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix the HasManyAssociation#count method so it uses the new ↵Rick Olson2006-04-191-17/+22
| | | | | | ActiveRecord::Base#count syntax, while maintaining backwards compatibility. [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4237 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Modify ActiveRecord::Base.count so it shares the same signature as ↵Rick Olson2006-04-141-10/+13
| | | | | | #calculate, but maintains backwards compatibility. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4211 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* fix calculations for the Oracle Adapter (closes #4626) [Michael Schoen]Rick Olson2006-04-061-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4192 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Enable Limit/Offset in Calculations (closes #4558) [lmarlow@yahoo.com]Rick Olson2006-04-061-1/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4185 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed documentationDavid Heinemeier Hansson2006-03-281-66/+66
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4078 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Making ActiveRecord faster [skaes]David Heinemeier Hansson2006-03-271-2/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4069 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add support for :include to with_scope [andrew@redlinesoftware.com]Michael Koziarski2006-03-271-2/+2
| | | | | | | | | Remove overrated warning from adapter_test git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Base.abstract_class? that marks which classes are not part of the ↵Rick Olson2006-03-161-1/+1
| | | | | | Active Record hierarchy. closes #3704 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3882 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Allow ordering of calculated results and/or grouped fields in calculations ↵Rick Olson2006-03-141-0/+1
| | | | | | [solo@gatelys.com] closes #4228 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3865 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Doc fix (closes #4014) [thijs@fngtps.com]David Heinemeier Hansson2006-03-021-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3741 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make calculations typecasty! (closes #4016) [Rick Olson]David Heinemeier Hansson2006-03-011-7/+37
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3722 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Compatibility patches for calculationsDavid Heinemeier Hansson2006-02-251-31/+27
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3653 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added calculations: Base.count, Base.average, Base.sum, Base.minimum, ↵David Heinemeier Hansson2006-02-251-0/+197
Base.maxmium, and the generic Base.calculate. All can be used with :group and :having. Calculations and statitics need no longer require custom SQL. #3958 [Rick Olson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3646 5ecf4fe2-1ee6-0310-87b1-e25e094e27de