Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | `Relation#count` doesn't use options anymore. | Vipul A M | 2013-10-13 | 1 | -3/+2 | |
| | ||||||
* | Don't use Enumerable#next in pluck since it is very slow | Ryan Wallace | 2013-08-30 | 1 | -2/+1 | |
| | ||||||
* | re-introduce `select_for_count` private method. | Yves Senn | 2013-07-14 | 1 | -5/+10 | |
| | | | | See https://github.com/rails/rails/commit/da9b5d4a8435b744fcf278fffd6d7f1e36d4a4f2#commitcomment-3630064 for discussion. | |||||
* | no need to to_sym the column name, leave it as-is | Aaron Patterson | 2013-07-02 | 1 | -1/+1 | |
| | ||||||
* | avoid intermediate zipped array | Aaron Patterson | 2013-07-01 | 1 | -3/+2 | |
| | ||||||
* | make the identity type a singleton to save on object creation | Aaron Patterson | 2013-07-01 | 1 | -3/+1 | |
| | ||||||
* | only deal with strings internally | Aaron Patterson | 2013-07-01 | 1 | -3/+3 | |
| | ||||||
* | build an AST rather than slapping strings together | Aaron Patterson | 2013-07-01 | 1 | -11/+7 | |
| | ||||||
* | stop exposing the underlying alias datastructure | Aaron Patterson | 2013-07-01 | 1 | -4/+4 | |
| | ||||||
* | Remove deprecated `:distinct` option from `Relation#count`. | Yves Senn | 2013-07-01 | 1 | -5/+0 | |
| | ||||||
* | Simplify/fix implementation of default scopes | Jon Leighton | 2013-06-28 | 1 | -9/+3 | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation was necessary in order to support stuff like: class Post < ActiveRecord::Base default_scope where(published: true) scope :ordered, order("created_at") end If we didn't evaluate the default scope at the last possible moment before sending the SQL to the database, it would become impossible to do: Post.unscoped.ordered This is because the default scope would already be bound up in the "ordered" scope, and therefore wouldn't be removed by the "Post.unscoped" part. In 4.0, we have deprecated all "eager" forms of scopes. So now you must write: class Post < ActiveRecord::Base default_scope { where(published: true) } scope :ordered, -> { order("created_at") } end This prevents the default scope getting bound up inside the "ordered" scope, which means we can now have a simpler/better/more natural implementation of default scoping. A knock on effect is that some things that didn't work properly now do. For example it was previously impossible to use #except to remove a part of the default scope, since the default scope was evaluated after the call to #except. | |||||
* | Remove fall back and column restrictions for `count`. | Yves Senn | 2013-06-09 | 1 | -10/+6 | |
| | ||||||
* | Merge pull request #10561 from Empact/nix-throwresult | Jon Leighton | 2013-06-07 | 1 | -2/+0 | |
|\ | | | | | Rather than raising ThrowResult when construct_limited_ids_conditions comes up empty, set the relation to NullRelation and rely on its results. | |||||
| * | Rather than raising ThrowResult when construct_limited_ids_conditions comes ↵ | Ben Woosley | 2013-05-10 | 1 | -4/+0 | |
| | | | | | | | | | | | | up empty, set the relation to NullRelation and rely on its results. This will help avoid errors like 2fcafee250ee2, because in most cases NullRelation will do the right thing. Minor bonus is avoiding the use of exceptions for flow control. | |||||
| * | Fix that #pluck wasn't rescuing ThrowResult, meaning it would blow up when ↵ | Ben Woosley | 2013-05-10 | 1 | -0/+2 | |
| | | | | | | | | failing to construct_limited_ids_condition. | |||||
* | | Remove #sum with a block was deprecated. | kennyj | 2013-06-01 | 1 | -9/+1 | |
|/ | ||||||
* | Handle aliased attributes in ActiveRecord::Relation. | Godfrey Chan | 2013-05-01 | 1 | -8/+18 | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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* | |||||
* | Prefer find_by over dynamic finders in rdoc | Sam Ruby | 2013-04-02 | 1 | -1/+1 | |
| | ||||||
* | Merge branch 'master' of github.com:lifo/docrails | Vijay Dev | 2013-03-30 | 1 | -1/+1 | |
|\ | | | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb activerecord/test/cases/adapter_test.rb guides/source/testing.md [ci skip] | |||||
| * | Uniq cannot be used directly on an ActiveRecord model. 'DISTINCT field' is ↵ | Daniel Lobato | 2013-03-12 | 1 | -1/+1 | |
| | | | | | | | | the only pluck query that translates into the aforementioned SQL | |||||
* | | Deprecate the `:distinct` option for `Relation#count`. | Yves Senn | 2013-03-15 | 1 | -2/+7 | |
| | | | | | | | | | | | | | | 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 | -2/+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`. | |||||
* | copy edits [ci skip] | Vijay Dev | 2013-02-15 | 1 | -1/+1 | |
| | ||||||
* | Add ActiveRecord.count documentation when used on group relations | Maurizio De Santis | 2013-02-07 | 1 | -0/+6 | |
| | ||||||
* | `#count` in conjunction with `#uniq` performs distinct count. | Yves Senn | 2013-01-26 | 1 | -1/+2 | |
| | | | | closes #6865 | |||||
* | Revert "Merge pull request #8989 from robertomiranda/use-rails-4-find-by" | Guillermo Iguaran | 2013-01-18 | 1 | -1/+1 | |
| | | | | | This reverts commit 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a, reversing changes made to 5937bd02dee112646469848d7fe8a8bfcef5b4c1. | |||||
* | User Rails 4 find_by | robertomiranda | 2013-01-18 | 1 | -1/+1 | |
| | ||||||
* | These are already required through AS/rails | Akira Matsuda | 2013-01-07 | 1 | -2/+0 | |
| | | | | | | * dependencies/autoload * concern * deprecation | |||||
* | warning removed: shadowing outer local variable | Arun Agrawal | 2012-12-30 | 1 | -2/+2 | |
| | ||||||
* | fix time typcasting on group counts in PG | Aaron Patterson | 2012-12-28 | 1 | -2/+5 | |
| | ||||||
* | mysql does not return alias names, so fall back | Aaron Patterson | 2012-12-28 | 1 | -4/+10 | |
| | ||||||
* | fix PG typecasting errors | Aaron Patterson | 2012-12-28 | 1 | -2/+5 | |
| | ||||||
* | Cleans and removes useless 'Examples' tag [ci skip] | Alvaro Pereyra | 2012-12-01 | 1 | -7/+2 | |
| | ||||||
* | copy edits [ci skip] | Vijay Dev | 2012-12-01 | 1 | -1/+1 | |
| | ||||||
* | Fix Calculations#pluck doc to mention several attributes can be selected [ci ↵ | Florent Guilleux | 2012-12-01 | 1 | -3/+3 | |
| | | | | skip] | |||||
* | Deprecate Relation#sum with a block. | Carlos Antonio da Silva | 2012-11-21 | 1 | -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 Silva | 2012-11-21 | 1 | -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 comments | Carlos Antonio da Silva | 2012-11-17 | 1 | -2/+0 | |
| | ||||||
* | Merge branch 'master' of github.com:lifo/docrails | Vijay Dev | 2012-11-17 | 1 | -1/+1 | |
|\ | | | | | | | | | Conflicts: actionpack/lib/action_dispatch/routing/redirection.rb | |||||
| * | 1.9 Syntax related changes | AvnerCohen | 2012-11-10 | 1 | -1/+1 | |
| | | ||||||
* | | arel columns can be used for grouping so that "weird" column names are usable | Aaron Patterson | 2012-11-15 | 1 | -0/+4 | |
| | | ||||||
* | | stop hardcoding FrontBase adapter conditionals | Aaron Patterson | 2012-11-15 | 1 | -1/+1 | |
| | | ||||||
* | | stop passing *args to generate aliases | Aaron Patterson | 2012-11-15 | 1 | -4/+2 | |
| | | ||||||
* | | create fewer relation objects | Aaron Patterson | 2012-11-15 | 1 | -3/+6 | |
| | | ||||||
* | | `#pluck` can be used on a relation with `select` clause. | Yves Senn | 2012-11-12 | 1 | -1/+3 | |
|/ | | | | Closes #7551 | |||||
* | use columns hash to look up the column for the count field | Aaron Patterson | 2012-10-17 | 1 | -1/+1 | |
| | ||||||
* | ActiveRecord: sum expression returns string '0' for no records, fixed | Tim Macfarlane | 2012-10-15 | 1 | -1/+1 | |
| | ||||||
* | Fix pluck when columns/tables are reserved words. | Ian Lesperance | 2012-09-05 | 1 | -1/+1 | |
| | ||||||
* | load active_support/core_ext/object/blank in active_support/rails | Xavier Noria | 2012-08-02 | 1 | -1/+0 | |
| | ||||||
* | Ensure Arel columns are typecasted properly when grouping with calculation | Carlos Antonio da Silva | 2012-06-25 | 1 | -6/+6 | |
| | | | | Fix build issue with postgresql. |