aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/calculations.rb
Commit message (Collapse)AuthorAgeFilesLines
* Using map. No need to run query againArun Agrawal2013-05-101-1/+1
|
* Fixed pluck to be working with selects.Arun Agrawal2013-05-101-1/+4
| | | | | | | | | | | | | See #9777 for details. Previously pluck is not returning what we wanted to Added a test also to make sure it's working fine. This will also fix the build for 1.8.7 as we were doing some sort on hash. Thanks @pixeltrix for helping me out. Thanks @linduxed for pairing with me.
* Remove useless elseArun Agrawal2013-05-101-3/+0
|
* Revert "Merge pull request #8209 from senny/backport_8176"Rafael Mendonça França2013-05-081-3/+2
| | | | | | | | | | | | | | | This reverts commit 724020278480855bddfe749c91f1074d4f50f3c6, reversing changes made to e4e2bcce75b85fb8c1c49509a17bd5dfe6034c32. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/calculations.rb activerecord/test/cases/calculations_test.rb Reason: This caused a regression since it changed the behavior in a stable release. Fixes #9777
* Merge pull request #9078 from senny/6865_ar_count_with_uniqRafael Mendonça França2013-02-021-1/+2
| | | | | | `#count` in conjunction with `#uniq` performs distinct count. Conflicts: activerecord/CHANGELOG.md
* Fix pluck when columns/tables are reserved words.Ian Lesperance2013-01-231-1/+1
| | | | | | | | | Backport #7536 to fix #8968. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/calculations.rb
* Revert "Merge pull request #7983 from georgebrock/bug7950-squashed"Carlos Antonio da Silva2013-01-151-4/+3
| | | | | | | | | | | This reverts commit 88a296dccc401da143d90cad54b693ff06bf2b58, reversing changes made to 666a7e34f553cef4c8878362eafc79c7e3f310c3. Conflicts: activerecord/CHANGELOG.md Reason: this has been resulting in some hard to track bugs and is introducing a possible breackage in a stable version.
* Merge pull request #4942 from bogdan/pluck_joinsJosé Valim2012-12-031-1/+6
| | | | | | | | AR::Relation#pluck: improve to work with joins Conflicts: activerecord/lib/active_record/relation/calculations.rb activerecord/test/cases/calculations_test.rb
* Merge pull request #7983 from georgebrock/bug7950-squashedCarlos Antonio da Silva2012-11-161-3/+4
|\ | | | | | | | | | | | | | | Backport 4bc2ae0 to fix #7950 Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/calculations.rb
| * use bind values for join columnsAaron Patterson2012-11-101-3/+4
| | | | | | | | | | | | | | | | | | | | This is a backport of 4bc2ae0da1dd812aee759f6d13ad428354cd0e13. It fixes bug #7950. Conflicts: activerecord/lib/active_record/relation/calculations.rb activerecord/lib/active_record/relation/finder_methods.rb
* | backport #8176, `#pluck` can be used on a relation with `select` clause.Yves Senn2012-11-131-1/+3
|/ | | | | | | | Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/calculations.rb activerecord/test/cases/calculations_test.rb
* Ensure Arel columns are typecasted properly when grouping with calculationCarlos Antonio da Silva2012-06-251-3/+3
| | | | | | | | Fix build issue with postgresql. Conflicts: activerecord/lib/active_record/relation/calculations.rb activerecord/test/cases/calculations_test.rb
* Merge pull request #6842 from ernie/handle-non-strings-in-grouped-calculationsRafael Mendonça França2012-06-241-6/+17
| | | | | | Stop assuming strings for grouped calculations Conflicts: activerecord/lib/active_record/relation/calculations.rb
* Make ActiveRecord::Relation#pluck work with serialized attributesJon Leighton2011-12-221-4/+4
|
* ActiveRecord::Relation#pluck methodBogdan Gusiev2011-11-301-0/+17
|
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-2/+2
| | | | for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
* Fixed failing query when performing calculation with having based on select.Dmitriy Kiriyenko2011-07-271-0/+1
|
* Fixed AR::Relation#sum compatibility with Array#sumBogdan Gusiev2011-07-051-2/+6
| | | | | In order make Relation behavior closer to Array Made Relation#sum to accept block and delegate it to Array#sum
* Apply the default scope earlier when doing calculations. Fixes #1682.Jon Leighton2011-06-231-5/+11
|
* Ensure that calculations properly override the select value even if it's set ↵Jon Leighton2011-05-311-2/+2
| | | | in the default scope. Fixes #1395.
* Remove extra white spaces on ActiveRecord docs.Sebastian Martinez2011-05-231-4/+4
|
* Bug fixes:Fadzril Muhamad & Joseph Palermo2011-05-121-5/+4
| | | | | | - If doing a count on a relation that has an :include and a :join, it does a distinct even though it should not. - When doing a count on a relation that has an :include, it always falls back to a old style left join when performing the count. Looks like it was broken here: https://github.com/rails/rails/commit/b9599502c9e738a5a1513e75d08f8d40ed408265
* Ensure that ORDER BY clauses from default scopes are not included in ↵Jon Leighton2011-05-081-1/+1
| | | | calculation queries. Fixes #406.
* Use Arel to build subquery. Adapt tests to changed fixtures.John Mileham2011-03-241-13/+12
|
* Change behavior of count(:limit => x, :offset => y) to limit/offset before ↵John Mileham2011-03-031-14/+26
| | | | counting.
* removing limits and offsets from COUNT queries unless both are specified. ↵Aaron Patterson2011-02-251-1/+13
| | | | [#6268 state:resolved]
* The type_cast_calculated_value method will trust DB types before casting to ↵Ken Collins2011-02-031-1/+1
| | | | | | | | a BigDecimal. [#6365 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Always return decimal average of integer fieldsRaimonds Simanovskis2011-01-101-9/+5
| | | | 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.
* ActiveRecord::Relation#primary_key should return a string, just like ↵Jon Leighton2011-01-031-1/+1
| | | | ActiveRecord::Base.primary_key does.
* Rename AssociationReflection#primary_key_name to foreign_key, since the ↵Jon Leighton2010-12-311-1/+1
| | | | options key which it relates to is :foreign_key
* just grep the AST for OuterJoin nodes rather than converting the tree to SQLAaron Patterson2010-11-301-1/+1
|
* reduce method calls on arelAaron Patterson2010-11-301-1/+1
|
* refactor to reduce method callsAaron Patterson2010-11-161-10/+19
|
* Fix ActiveRecord calculations when grouped by multiple fieldsAlexandru Catighera2010-11-161-14/+18
|
* we should always cast the value based on the columnAaron Patterson2010-10-111-1/+1
|
* Honor distinct option when used with count operation after group clause ↵Marcelo Giorgi2010-10-111-4/+8
| | | | [#5721 state:resolved]
* [#5441 state:resolved] refactoring code to determine aggregate columnAaron Patterson2010-09-301-11/+14
|
* refactoring to remove crazy logicAaron Patterson2010-09-281-1/+5
|
* fisting the postgresql testsAaron Patterson2010-09-281-1/+2
|
* avoid calling to_sql when we canAaron Patterson2010-09-281-3/+3
|
* removing an inject + merge in favor of Hash#[]Aaron Patterson2010-09-281-1/+1
|
* Goodbye inject, hello map.Emilio Tagua2010-09-221-7/+5
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* return is not needed hereNeeraj Singh2010-09-091-2/+2
|
* remove unnecessary callNeeraj Singh2010-09-091-1/+0
| | | | if operation is count then column_name will never be blank
* attributes should be constructed with table objectsAaron Patterson2010-09-071-1/+1
|
* attributes should be associated with tablesAaron Patterson2010-09-071-1/+1
|
* Use new finders syntax in docs.Emilio Tagua2010-09-011-2/+2
|
* minor formatting fixesNeeraj Singh2010-08-251-8/+6
|
* refactoring to remove duplicate logicAaron Patterson2010-08-181-4/+3
|
* call to present? is not necessaryAaron Patterson2010-08-181-2/+1
|