aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/calculations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add tests for relation count. Fix other tests that were conceptually wrong.Emilio Tagua2010-06-241-1/+1
| | | | | | [#4882 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Refactor calculation test to remove unneeded SQLite special case.Santiago Pastorino2010-05-241-4/+1
| | | | | | [#4633] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* type_cast_calculated_value refactor: value is never a Fixnum here. Fix test ↵Santiago Pastorino2010-05-111-2/+1
| | | | | | | | since SQLite returns Float. [#4514 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix associations to call :destroy or :delete based on the right :dependent ↵Carlos Antonio da Silva2010-03-091-2/+2
| | | | | | option Signed-off-by: José Valim <jose.valim@gmail.com>
* future proofing the sqlite3 adapter codeAaron Patterson2010-01-261-0/+3
| | | | Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
* Add Relation#construct_relation_for_association_calculations for ↵Pratik Naik2010-01-191-17/+0
| | | | calculations with includes
* Migrate all the calculation methods to RelationPratik Naik2009-12-291-10/+8
|
* Don't publicize with_scope for tests since it may shadow public misuseJeremy Kemper2009-12-281-1/+1
|
* Merge commit 'rails/master'Emilio Tagua2009-08-101-0/+6
|\ | | | | | | | | | | | | 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/+6
| | | | | | | | | | Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1229 state:committed]
* | Merge commit 'rails/master'Emilio Tagua2009-08-081-1/+6
|\| | | | | | | | | | | Conflicts: activerecord/test/cases/adapter_test.rb activerecord/test/cases/method_scoping_test.rb
| * Oracle adapter returns numeric (not string) value after SUMRaimonds Simanovskis2009-08-061-1/+6
| |
* | Merge commit 'rails/master'Emilio Tagua2009-06-301-2/+2
|\|
| * Revert "Revert "Generate proper :counter_sql from :finder_sql when there is ↵Pratik Naik2009-07-011-2/+2
| | | | | | | | | | | | | | | | | | a newline character immediately following 'SELECT' [#2118 state:resolved]"" This reverts commit 80f1f863cd0f9cba89079511282de5710a2e1832. The feature doesn't work on Postgres, so don't test it on Postgres. Also, Postgres compatibility is irrelevant to the ticket/patch in question.
| * Revert "Generate proper :counter_sql from :finder_sql when there is a ↵Yehuda Katz + Carl Lerche2009-06-221-2/+2
| | | | | | | | | | | | | | | | newline character immediately following 'SELECT' [#2118 state:resolved]" This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a. The tests do not pass for postgresql.
| * Generate proper :counter_sql from :finder_sql when there is a newline ↵Patrick Joyce2009-06-211-2/+2
| | | | | | | | | | | | character immediately following 'SELECT' [#2118 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* | Merge commit 'rails/master'Emilio Tagua2009-04-291-1/+1
|\|
| * Fix duplicated test nameEmilio Tagua2009-04-291-1/+1
| | | | | | | | | | | | [#2581 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* | Calculations now use Arel to construct the query.Emilio Tagua2009-04-291-1/+1
|/ | | | Implemented other methods in AR::Base with Arel support.
* Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-081-2/+2
| | | | [#1617 state:resolved]
* Fix calculation tests to work on sqlitePratik Naik2009-03-071-5/+7
|
* Ensure calculations respect scoped :select [#1334 state:resolved]stopdropandrew2009-03-071-0/+11
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Allow :having conditions to be sanitized like regular :condition. [#2158 ↵Will Bryant2009-03-061-0/+8
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Bump mocha requirement for Ruby 1.9 compat. Remove uses_mocha.Jeremy Kemper2009-02-031-19/+17
|
* Rework ActiveSupport::OrderedHash to make lookups fasterFrederick Cheung2008-12-101-2/+3
| | | | | | [#1352 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Make sure any Fixnum returned by a DB sum is type cast to a Float before ↵Ken Collins2008-11-131-0/+5
| | | | | | standard converstion to a BigDecimal [#8994 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/+3
| | | | | Model.sum delegates typecasting to the column being summed. If that's not feasible, returns a string. Model.avg always returns big decimal.
* Add :from option to calculations. [#397 state:resolved]Ben Munat2008-06-111-0/+46
|
* Ensure AR#sum result is typecasted properlyPratik Naik2008-06-021-0/+5
|
* Ensure Associations#sum returns 0 when no rows are returned. [#295 ↵Jonathan Viney2008-06-021-1/+2
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* ActiveRecord::Base#sum defaults to 0 if no rows are returned. Closes #11550 ↵Rick Olson2008-04-081-0/+4
| | | | | | [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-0/+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-0/+4
| | | | | | [nbugajski/cavelle] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix calculations on associations with custom :foreign_key. Closes #8117 ↵Jeremy Kemper2008-02-021-0/+8
| | | | | | [kamal, jack] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8778 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/railsJeremy Kemper2008-01-211-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix pathsJeremy Kemper2008-01-181-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Move tests to casesJeremy Kemper2008-01-181-0/+251
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de