aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/calculations.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use immutable relation objects to generate queries.Emilio Tagua2009-08-181-8/+7
|
* Use finder options as relation method names to provide more familiarEmilio Tagua2009-08-181-9/+9
| | | | | naming. Use bang methods convention in methods that alter the relation.
* Remove group when building the relation, it will be added later ifEmilio Tagua2009-08-161-1/+0
| | | | options[:group] is given.
* Don't use regular rinder on calculations since scoping order blowsEmilio Tagua2009-08-141-1/+7
| | | | PostreSQL.
* Use ARel's joins when building a query for finding records with includedEmilio Tagua2009-08-141-17/+6
| | | | associations.
* Merge commit 'rails/master'Emilio Tagua2009-08-101-1/+0
|\ | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/calculations.rb activerecord/lib/active_record/connection_adapters/mysql_adapter.rb activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
| * Adding :from scoping to ActiveRecord calculationsMatt Duncan2009-08-091-0/+2
| | | | | | | | | | Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1229 state:committed]
* | Don't scope order in calculations.'Emilio Tagua2009-08-071-1/+1
| |
* | More work on removing plain SQL from associations and use ARel instead.Emilio Tagua2009-08-071-11/+20
| |
* | Refactoring: Calculations now use construct_finder_sql instead they own method.Emilio Tagua2009-06-231-19/+4
| |
* | Merge commit 'rails/master'Emilio Tagua2009-06-021-1/+1
|\| | | | | | | | | | | Conflicts: activerecord/lib/active_record.rb
| * Break up DependencyModule's dual function of providing a "depend_on" DSL and ↵Joshua Peek2009-05-281-1/+1
| | | | | | | | "included" block DSL into separate modules. But, unify both approaches under AS::Concern.
* | Refactors to work with latest Arel implementation.Emilio Tagua2009-06-021-10/+9
| |
* | Merge commit 'rails/master'Emilio Tagua2009-05-121-3/+2
|\|
| * Use DependencyModule for included hooks in ActiveRecordBryan Helmkamp2009-05-111-3/+2
| |
* | Refactor to calculations. Migration's versions are string not integer. ARel ↵Emilio Tagua2009-05-061-9/+8
| | | | | | | | submodule updated.
* | Fixes to have all test passing on PostgreSQL.Emilio Tagua2009-05-041-6/+22
| | | | | | | | | | | | Calculations now use construct_calculation_arel, making construct_finder_arel less hackish. Updated ARel to support PostgreSQL.
* | Refactor to use arel_table method, and also use the same method name for ↵Emilio Tagua2009-05-021-9/+7
| | | | | | | | instance and class methods.
* | Calculations now use Arel to construct the query.Emilio Tagua2009-04-291-111/+86
|/ | | | Implemented other methods in AR::Base with Arel support.
* Ensure calculations respect scoped :select [#1334 state:resolved]stopdropandrew2009-03-071-5/+13
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Allow :having conditions to be sanitized like regular :condition. [#2158 ↵Will Bryant2009-03-061-3/+5
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Merge docrailsPratik Naik2009-01-181-8/+16
|
* Make sure any Fixnum returned by a DB sum is type cast to a Float before ↵Ken Collins2008-11-131-1/+1
| | | | | | standard converstion to a BigDecimal [#8994 state:resolved] Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Add simple case when DB calculations returns 0 instead of 0.0 [#1346 ↵Joshua Peek2008-11-101-1/+1
| | | | state:resolved]
* If average value from DB is 0, make sure to convert it to a 0.0 float before ↵Ken Collins2008-11-071-1/+1
| | | | | | calling #to_d on it [#1346 state:resolved] Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Ensure Model.sum and Model.avg typecast appropriately. [#1066 state:resolved]Pratik Naik2008-10-041-3/+7
| | | | | Model.sum delegates typecasting to the column being summed. If that's not feasible, returns a string. Model.avg always returns big decimal.
* Remove AS for oracle compatibilityMichael Koziarski2008-10-031-1/+1
|
* Interpolation requires double quotesMichael Koziarski2008-09-091-1/+1
|
* Merge docrailsPratik Naik2008-09-031-2/+2
|
* 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