Commit Graph

36 Commits

Author SHA1 Message Date
Santiago Pastorino
47d568ed3f Refactor calculation test to remove unneeded SQLite special case.
[#4633]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-24 20:54:38 -07:00
Santiago Pastorino
5f3bd55726 type_cast_calculated_value refactor: value is never a Fixnum here. Fix test since SQLite returns Float.
[#4514 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-11 22:29:26 -07:00
Carlos Antonio da Silva
47d252f992 Fix associations to call :destroy or :delete based on the right :dependent option
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-09 00:11:34 +01:00
Aaron Patterson
beda2d43d6 future proofing the sqlite3 adapter code
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
2010-01-26 15:09:11 -08:00
Pratik Naik
b9599502c9 Add Relation#construct_relation_for_association_calculations for calculations with includes 2010-01-19 15:22:09 +05:30
Pratik Naik
08633bae5e Migrate all the calculation methods to Relation 2009-12-29 04:30:04 +05:30
Jeremy Kemper
949c8c0d0e Don't publicize with_scope for tests since it may shadow public misuse 2009-12-28 14:07:23 -08:00
Emilio Tagua
0e2fbd80e2 Merge commit 'rails/master'
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
2009-08-10 18:07:33 -03:00
Matt Duncan
3b3798506b Adding :from scoping to ActiveRecord calculations
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1229 state:committed]
2009-08-09 12:43:07 +12:00
Emilio Tagua
9520143159 Merge commit 'rails/master'
Conflicts:
	activerecord/test/cases/adapter_test.rb
	activerecord/test/cases/method_scoping_test.rb
2009-08-08 19:14:35 -03:00
Raimonds Simanovskis
a12358b3a5 Oracle adapter returns numeric (not string) value after SUM 2009-08-06 23:40:59 +03:00
Emilio Tagua
cbf8ecc1cb Merge commit 'rails/master' 2009-06-30 20:32:28 -03:00
Pratik Naik
45e6f19925 Revert "Revert "Generate proper :counter_sql from :finder_sql when there is 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.
2009-07-01 00:02:00 +01:00
Yehuda Katz + Carl Lerche
80f1f863cd Revert "Generate proper :counter_sql from :finder_sql when there is a newline character immediately following 'SELECT' [#2118 state:resolved]"
This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a.

The tests do not pass for postgresql.
2009-06-22 12:04:02 -07:00
Patrick Joyce
4851ca9e13 Generate proper :counter_sql from :finder_sql when there is a newline character immediately following 'SELECT' [#2118 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-06-21 22:07:23 +01:00
Emilio Tagua
b0bd4f45fa Merge commit 'rails/master' 2009-04-29 19:47:21 -03:00
Emilio Tagua
db892ea775 Fix duplicated test name
[#2581 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-04-29 15:46:43 -07:00
Emilio Tagua
19d2ff83db Calculations now use Arel to construct the query.
Implemented other methods in AR::Base with Arel support.
2009-04-29 19:39:53 -03:00
Jeremy Kemper
1c36172c13 Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.
[#1617 state:resolved]
2009-03-08 13:11:58 -07:00
Pratik Naik
df8669d4b5 Fix calculation tests to work on sqlite 2009-03-07 16:36:40 +00:00
stopdropandrew
6543426c73 Ensure calculations respect scoped :select [#1334 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-07 15:26:56 +00:00
Will Bryant
7fb7b48a1f Allow :having conditions to be sanitized like regular :condition. [#2158 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-03-06 22:29:53 +00:00
Jeremy Kemper
278186534c Bump mocha requirement for Ruby 1.9 compat. Remove uses_mocha. 2009-02-03 18:40:22 -08:00
Frederick Cheung
355f41d8aa Rework ActiveSupport::OrderedHash to make lookups faster
[#1352 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-12-10 09:07:47 -08:00
Ken Collins
57d795bad4 Make sure any Fixnum returned by a DB sum is type cast to a Float before standard converstion to a BigDecimal [#8994 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-11-13 10:45:57 -06:00
Pratik Naik
9599948fbc Ensure Model.sum and Model.avg typecast appropriately. [#1066 state:resolved]
Model.sum delegates typecasting to the column being summed. If that's not feasible, returns a string.
Model.avg always returns big decimal.
2008-10-04 20:13:44 +01:00
Ben Munat
ddab9d7fdf Add :from option to calculations. [#397 state:resolved] 2008-06-11 18:07:57 -07:00
Pratik Naik
bd75a722a2 Ensure AR#sum result is typecasted properly 2008-06-02 20:41:11 +01:00
Jonathan Viney
4210d85a3f Ensure Associations#sum returns 0 when no rows are returned. [#295 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-06-02 12:50:44 +01:00
Rick Olson
78c2d9fc22 ActiveRecord::Base#sum defaults to 0 if no rows are returned. Closes #11550 [kamal]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9243 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-08 05:20:33 +00:00
Michael Koziarski
50538fb524 Don't double include DISTINCT when the user has already specified it. Closes #11502 [kenneth.kalmer]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9223 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-04 12:06:22 +00:00
David Heinemeier Hansson
9e4558671c Ensure that you can still do expressions in calculations (closes #11355) [nbugajski/cavelle]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-17 04:02:34 +00:00
Jeremy Kemper
5bbc461fcb Fix calculations on associations with custom :foreign_key. Closes #8117 [kamal, jack]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8778 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-02 04:28:42 +00:00
Jeremy Kemper
39814fcce0 Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/rails
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-21 17:20:51 +00:00
Jeremy Kemper
1e70928014 Fix paths
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:31:37 +00:00
Jeremy Kemper
42b39ae3f2 Move tests to cases
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:30:42 +00:00