Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Remove deprecated `:distinct` option from `Relation#count`. | Yves Senn | 2013-07-01 | 1 | -10/+0 |
| | |||||
* | Remove fall back and column restrictions for `count`. | Yves Senn | 2013-06-09 | 1 | -0/+9 |
| | |||||
* | Merge pull request #10561 from Empact/nix-throwresult | Jon Leighton | 2013-06-07 | 1 | -0/+11 |
|\ | | | | | Rather than raising ThrowResult when construct_limited_ids_conditions comes up empty, set the relation to NullRelation and rely on its results. | ||||
| * | Add coverage for the fact that pluck without an argument returns all the ↵ | Ben Woosley | 2013-05-10 | 1 | -0/+5 |
| | | | | | | | | table's columns. | ||||
| * | Fix that #pluck wasn't rescuing ThrowResult, meaning it would blow up when ↵ | Ben Woosley | 2013-05-10 | 1 | -0/+6 |
| | | | | | | | | failing to construct_limited_ids_condition. | ||||
* | | Remove #sum with a block was deprecated. | kennyj | 2013-06-01 | 1 | -6/+0 |
|/ | |||||
* | Handle aliased attributes in ActiveRecord::Relation. | Godfrey Chan | 2013-05-01 | 1 | -0/+12 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | When using symbol keys, ActiveRecord will now translate aliased attribute names to the actual column name used in the database: With the model class Topic alias_attribute :heading, :title end The call Topic.where(heading: 'The First Topic') should yield the same result as Topic.where(title: 'The First Topic') This also applies to ActiveRecord::Relation::Calculations calls such as `Model.sum(:aliased)` and `Model.pluck(:aliased)`. This will not work with SQL fragment strings like `Model.sum('DISTINCT aliased')`. Github #7839 *Godfrey Chan* | ||||
* | replace #merge with relation API calls in calculations_test. | Yves Senn | 2013-04-02 | 1 | -17/+13 |
| | |||||
* | Deprecate the `:distinct` option for `Relation#count`. | Yves Senn | 2013-03-15 | 1 | -4/+14 |
| | | | | | | | We moved more and more away from passing options to finder / calculation methods. The `:distinct` option in `#count` was one of the remaining places. Since we can now combine `Relation#distinct` with `Relation#count` the option is no longer necessary and can be deprecated. | ||||
* | rename `Relation#uniq` to `Relation#distinct`. `#uniq` still works. | Yves Senn | 2013-03-15 | 1 | -1/+2 |
| | | | | | | | | The similarity of `Relation#uniq` to `Array#uniq` is confusing. Since our Relation API is close to SQL terms I renamed `#uniq` to `#distinct`. There is no deprecation. `#uniq` and `#uniq!` are aliases and will continue to work. I also updated the documentation to promote the use of `#distinct`. | ||||
* | `#count` in conjunction with `#uniq` performs distinct count. | Yves Senn | 2013-01-26 | 1 | -0/+4 |
| | | | | closes #6865 | ||||
* | fix PG typecasting errors | Aaron Patterson | 2012-12-28 | 1 | -20/+7 |
| | |||||
* | Deprecate Relation#sum with a block. | Carlos Antonio da Silva | 2012-11-21 | 1 | -2/+4 |
| | | | | | | | 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 Silva | 2012-11-21 | 1 | -16/+0 |
| | | | | | | | | | | | | | | 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 | ||||
* | `#pluck` can be used on a relation with `select` clause. | Yves Senn | 2012-11-12 | 1 | -0/+6 |
| | | | | Closes #7551 | ||||
* | remove unused variables. Oops! | Aaron Patterson | 2012-10-17 | 1 | -2/+2 |
| | |||||
* | use columns hash to look up the column for the count field | Aaron Patterson | 2012-10-17 | 1 | -13/+6 |
| | |||||
* | ActiveRecord: sum expression returns string '0' for no records, fixed | Tim Macfarlane | 2012-10-15 | 1 | -0/+4 |
| | |||||
* | Fix pluck when columns/tables are reserved words. | Ian Lesperance | 2012-09-05 | 1 | -2/+9 |
| | |||||
* | Remove ActiveRecord::Base.to_a | Jon Leighton | 2012-08-03 | 1 | -1/+1 |
| | | | | | On reflection, it seems like a bit of a weird method to have on ActiveRecord::Base, and it shouldn't be needed most of the time anyway. | ||||
* | Deprecate ActiveRecord::Base.scoped. | Jon Leighton | 2012-07-27 | 1 | -13/+13 |
| | | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders. | ||||
* | ActiveRecord::Base.all returns a Relation. | Jon Leighton | 2012-07-27 | 1 | -1/+1 |
| | | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway. | ||||
* | Deprecate update_column in favor of update_columns. | Rafael Mendonça França | 2012-07-24 | 1 | -2/+2 |
| | | | | Closes #1190 | ||||
* | teaching the mysql adapter how to typecast strings returned from the database | Aaron Patterson | 2012-07-13 | 1 | -2/+2 |
| | |||||
* | Ensure Arel columns are typecasted properly when grouping with calculation | Carlos Antonio da Silva | 2012-06-25 | 1 | -3/+7 |
| | | | | Fix build issue with postgresql. | ||||
* | Stop assuming strings for grouped calculations | Ernie Miller | 2012-06-24 | 1 | -0/+5 |
| | | | | | | | | | | | | | | | 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. | ||||
* | Refactor pluck with multiple columns | Carlos Antonio da Silva | 2012-06-22 | 1 | -10/+16 |
| | | | | | | | | | | | | 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 columns | jeroeningen | 2012-06-22 | 1 | -1/+16 |
| | |||||
* | Extract conditional to a method to avoid duplication | Rafael Mendonça França | 2012-06-19 | 1 | -0/+3 |
| | | | | Also use if/else block to not use short circuit return | ||||
* | handle joins/includes correctly for pluck and calculation. | Andrey Deryabin | 2012-06-19 | 1 | -0/+43 |
| | | | | Fix #5990 | ||||
* | Allow blocks for count with ActiveRecord::Relation. Document and test that ↵ | chrisfinne | 2012-05-28 | 1 | -0/+16 |
| | | | | sum allows blocks | ||||
* | MySQL returns "SUM(DISTINCT(credit_limit))" as the column name unless | Aaron Patterson | 2012-05-16 | 1 | -1/+5 |
| | | | | | 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 Menge | 2012-05-16 | 1 | -0/+3 |
| | |||||
* | Restore support for Model.pluck('sql fragment') | Jeremy Kemper | 2012-05-15 | 1 | -0/+8 |
| | |||||
* | Fix PR #6091 | Andrew White | 2012-04-30 | 1 | -1/+1 |
| | | | | | | 1. ActiveRecord::Base is not ActiveRecord::Relation 2. The order of records from an SQL query is uncertain without an ORDER clause 3. Run your own tests when submitting a pull request | ||||
* | Add ActiveRecord::Base#ids | twinturbo | 2012-04-30 | 1 | -0/+4 |
| | |||||
* | remove deprecate #calculate calls | Jon Leighton | 2012-04-26 | 1 | -76/+59 |
| | |||||
* | remove tests for #with_scope (it's now deprecated) | Jon Leighton | 2012-04-25 | 1 | -6/+0 |
| | |||||
* | fix tests | Jon Leighton | 2012-04-13 | 1 | -5/+5 |
| | |||||
* | typecast columns based on the returned types | Aaron Patterson | 2012-02-09 | 1 | -6/+1 |
| | |||||
* | PostgreSQL does not work in the same way of the other adapters | Rafael Mendonça França | 2012-02-08 | 1 | -3/+7 |
| | |||||
* | AR::Relation#pluck: improve to work with joins | Bogdan Gusiev | 2012-02-08 | 1 | -0/+11 |
| | |||||
* | Deprecate inferred JOINs with includes + SQL snippets. | Jon Leighton | 2012-01-16 | 1 | -3/+3 |
| | | | | | | See the CHANGELOG for details. Fixes #950. | ||||
* | Revert "Deprecate implicit eager loading. Closes #950." | Jon Leighton | 2012-01-16 | 1 | -6/+4 |
| | | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9. | ||||
* | Deprecate implicit eager loading. Closes #950. | Jon Leighton | 2011-12-29 | 1 | -4/+6 |
| | |||||
* | Make ActiveRecord::Relation#pluck work with serialized attributes | Jon Leighton | 2011-12-22 | 1 | -1/+8 |
| | |||||
* | ActiveRecord::Relation#pluck method | Bogdan Gusiev | 2011-11-30 | 1 | -0/+25 |
| | |||||
* | pg does not allow aliases in the having clause, but functions are fine | Aaron Patterson | 2011-08-05 | 1 | -1/+1 |
| | |||||
* | Fixed failing query when performing calculation with having based on select. | Dmitriy Kiriyenko | 2011-07-27 | 1 | -0/+7 |
| | |||||
* | Fixed AR::Relation#sum compatibility with Array#sum | Bogdan Gusiev | 2011-07-05 | 1 | -0/+4 |
| | | | | | In order make Relation behavior closer to Array Made Relation#sum to accept block and delegate it to Array#sum |