aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/calculations.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Deprecate Relation#sum with a block.Carlos Antonio da Silva2012-11-211-0/+6
| | | | | | | To perform a sum calculation over the array of elements, use to_a.sum(&block). Please check the discussion in f9cb645dfcb5cc89f59d2f8b58a019486c828c73 for more context.
* Revert "Yield only one argument instead of splatting."Carlos Antonio da Silva2012-11-211-14/+3
| | | | | | | | | | | | | | This reverts commit f9cb645dfcb5cc89f59d2f8b58a019486c828c73. Conflicts: activerecord/CHANGELOG.md Revert "Allow blocks for count with ActiveRecord::Relation. Document and test that sum allows blocks" This reverts commit 9cc2bf69ce296b7351dc612a8366193390a305f3. Conflicts: activerecord/lib/active_record/relation/calculations.rb
* Remove not used require and some useless test commentsCarlos Antonio da Silva2012-11-171-2/+0
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-171-1/+1
|\ | | | | | | | | Conflicts: actionpack/lib/action_dispatch/routing/redirection.rb
| * 1.9 Syntax related changesAvnerCohen2012-11-101-1/+1
| |
* | arel columns can be used for grouping so that "weird" column names are usableAaron Patterson2012-11-151-0/+4
| |
* | stop hardcoding FrontBase adapter conditionalsAaron Patterson2012-11-151-1/+1
| |
* | stop passing *args to generate aliasesAaron Patterson2012-11-151-4/+2
| |
* | create fewer relation objectsAaron Patterson2012-11-151-3/+6
| |
* | `#pluck` can be used on a relation with `select` clause.Yves Senn2012-11-121-1/+3
|/ | | | Closes #7551
* use columns hash to look up the column for the count fieldAaron Patterson2012-10-171-1/+1
|
* ActiveRecord: sum expression returns string '0' for no records, fixedTim Macfarlane2012-10-151-1/+1
|
* Fix pluck when columns/tables are reserved words.Ian Lesperance2012-09-051-1/+1
|
* load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
|
* Ensure Arel columns are typecasted properly when grouping with calculationCarlos Antonio da Silva2012-06-251-6/+6
| | | | Fix build issue with postgresql.
* Stop assuming strings for grouped calculationsErnie Miller2012-06-241-6/+17
| | | | | | | | | | | | | | | Execute_grouped_calculation is one of those places where ActiveRecord forgets that it has ARel underpinnings, and assumes that the values provided to group_values are strings. This artificially hobbles otherwise functional code. This patch stops assuming that incoming values respond to to_sym, stops using string interpolation for table aliases on objects that support aliasing, and stops unnecessarily joining group_values on the relation. Additionally, it calls to_sql, if available, on objects sent to column_alias_for, in order to get a more reasonable alias string than a non-string's default to_str method.
* Add changelog entry and guide updates for pluck with multiple columnsCarlos Antonio da Silva2012-06-221-0/+1
|
* Refactor pluck with multiple columnsCarlos Antonio da Silva2012-06-221-26/+13
| | | | | | | | | | | | Ensure it works with mix of symbols and strings, and with a select clause possibly containing more than one column. Also remove support for pluck with an array of columns, in favor of passing the list of attributes: Model.pluck(:a, :b) See comments: https://github.com/rails/rails/pull/6500#issuecomment-6030292
* ActiveRecord#pluck now accepts multiple columnsjeroeningen2012-06-221-15/+35
|
* Extract conditional to a method to avoid duplicationRafael Mendonça França2012-06-191-15/+19
| | | | Also use if/else block to not use short circuit return
* handle joins/includes correctly for pluck and calculation.Andrey Deryabin2012-06-191-1/+6
| | | | Fix #5990
* Fix wrong example for count method with block [ci skip]Carlos Antonio da Silva2012-05-311-1/+1
| | | | Thanks @splattael.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-05-301-1/+1
|\
| * "a sql" -> "an SQL" per API documentation guidelinesMark Rushakoff2012-05-271-1/+1
| |
* | Yield only one argument instead of splatting.Carlos Antonio da Silva2012-05-281-2/+2
| | | | | | | | Add Changelog entry. Closes #4003
* | Allow blocks for count with ActiveRecord::Relation. Document and test that ↵chrisfinne2012-05-281-3/+14
|/ | | | sum allows blocks
* assuming there is only one column, we can simplify the type cast loopAaron Patterson2012-05-161-7/+6
|
* MySQL returns "SUM(DISTINCT(credit_limit))" as the column name unlessAaron Patterson2012-05-161-4/+11
| | | | | an alias is provided. Without the alias, the column cannot be found and properly typecast.
* Fixes issue where SQL fragments prevented type casting based on column type.Erich Menge2012-05-161-8/+3
|
* Expand and improve #pluck docsJeremy Kemper2012-05-151-6/+27
|
* Restore support for Model.pluck('sql fragment')Jeremy Kemper2012-05-151-1/+2
|
* Lowercase.Ben Pickles2012-05-011-1/+1
|
* Add ActiveRecord::Base#idstwinturbo2012-04-301-0/+10
|
* extract deprecated #calculate codeJon Leighton2012-04-131-83/+25
|
* use a hash to store relation valuesJon Leighton2012-04-131-5/+5
|
* Missing generated query for pluck method. Juanjo Bazán2012-03-271-1/+1
| | | (and changed the use of true for a more database agnostic example).
* Merge pull request #4984 from raghunadhd/change_orderhashVijay Dev2012-03-031-1/+1
|\ | | | | Refactored code
| * Refactored codeRaghunadh2012-02-101-1/+1
| |
* | use bind values for join columnsAaron Patterson2012-02-271-3/+4
| |
* | typecast columns based on the returned typesAaron Patterson2012-02-091-2/+14
|/
* AR::Relation#pluck: improve to work with joinsBogdan Gusiev2012-02-081-0/+3
|
* rewrites a couple of alternations in regexps as character classesXavier Noria2012-01-301-1/+1
| | | | | Character classes are the specific regexp construct to express alternation of individual characters.
* Delete unnecessary line that was necessary before I changed the code and it ↵Jon Leighton2011-12-221-1/+0
| | | | became no longer necessary.
* 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.