Aaron Patterson
0471fc9f1c
Merge branch 'master' into zomg
...
* master: (51 commits)
order is not guaranteed by this select, so add an order and call first!
oracle stores this with microseconds, so convert to seconds before comparing
make sure that active connections are not cleared during test when an exception happens
clearing active connections in the ConnectionManagement middleware if an exception happens
proxy body responses so we close database connections after body is flushed
Pass the proper method_name instead of hardcoding to action_name.
Quote find_in_batches ORDER BY clause [#6620 state:resolved]
Delegate first!, last!, any? and many? to scoped
Dont call authenticate_or_request_with_http_basic twice
Remove 'warning: ambiguous first argument' when running ActionPack tests
Change exists? so that it doesn't instantiate records [#6127 state:resolved]
Move mapper_test to the appropriate location
Update the wildcard route to be non-greedy by default, therefore be able to match the (.:format) segment [#6605 state:resolved]
Fix examples
Added Base.http_basic_authenticate_with to do simple http basic authentication with a single class method call [DHH]
make sure we have an active database connection before running each connection management test
adding active_connections? to the connection pool for finding open connections
adding active_connection? to the connection pool
testing app delegation from the ConnectionManagement middleware
namespacing connection management tests. ❤️
...
2011-03-29 17:38:43 -07:00
Sebastian Martinez
245542ea29
Added new #update_column method.
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-27 21:47:38 -03:00
Sebastian Martinez
0e1fed537a
Revert "Removed #update_attribute method. New #update_column method."
...
This reverts commit 45c233ef819dc7b67e259dd73f24721fec28b8c8.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-27 18:55:30 -03:00
Sebastian Martinez
45c233ef81
Removed #update_attribute method. New #update_column method.
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-26 12:09:04 -03:00
John Mileham
d5994ee48a
Change behavior of count(:limit => x, :offset => y) to limit/offset before counting.
2011-03-03 23:26:45 -05:00
Aaron Patterson
a8dae084c9
skip this on oracle
2011-02-28 09:15:19 -08:00
Aaron Patterson
54a2bf6601
removing limits and offsets from COUNT queries unless both are specified. [ #6268 state:resolved]
2011-02-25 15:38:59 -08:00
Ken Collins
95d5d9b6c4
The type_cast_calculated_value method will trust DB types before casting to a BigDecimal.
...
[#6365 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-03 20:00:51 -02:00
Raimonds Simanovskis
f4f4964ce0
Always return decimal average of integer fields
...
In previous version if database adapter (e.g. SQLite and Oracle) returned non-String calculated values then type_cast_using_column converted decimal average value of intefer field to integer value. Now operation parameter is always checked to decide which conversion of calculated value should be done.
2011-01-10 15:51:32 -08:00
Alexandru Catighera
a5cdf0b9eb
Fix ActiveRecord calculations when grouped by multiple fields
2010-11-16 10:38:47 -08:00
Marcelo Giorgi
1c9022de21
Honor distinct option when used with count operation after group clause [ #5721 state:resolved]
2010-10-11 09:39:34 -07:00
Aaron Patterson
cc18034c8c
group clause must be more specific
2010-09-30 10:17:34 -07:00
oleg dashevskii
ab9622ee62
Tests proving #5441
2010-09-30 10:17:29 -07:00
Brian Lopez
21e81da335
update tests for mysql2 support
2010-08-02 01:37:57 -07:00
Emilio Tagua
5441e082f9
Add tests for relation count. Fix other tests that were conceptually wrong.
...
[#4882 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-24 11:41:55 +02:00
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