aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
Commit message (Collapse)AuthorAgeFilesLines
* Privatize unneededly protected methods in Active RecordAkira Matsuda2017-01-051-1/+1
|
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-053-3/+3
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Remove unneeded requires at active recordRafael Mendonça França2017-01-031-1/+0
|
* Raise ArgumentError when a instance of ActiveRecord::Base is passed toRafael Mendonça França2017-01-031-7/+5
| | | | find and exists?
* Mark internal cache constants as privateMatthew Draper2016-12-311-1/+4
| | | | Closes #14640
* Remove deprecated `#uniq`, `#uniq!`, and `#uniq_value`Ryuta Kamizono2016-12-301-4/+0
|
* Remove deprecated support to passing arguments to `#select` when a block is ↵Rafael Mendonça França2016-12-291-3/+1
| | | | provided.
* Remove deprecated support to query using commas on LIMITRafael Mendonça França2016-12-291-19/+2
|
* Remove deprecated support to passing a class as a value in a queryRafael Mendonça França2016-12-292-31/+0
|
* Raises IrreversibleOrderError when using last with an irreversible orderRafael Mendonça França2016-12-291-8/+0
|
* Merge pull request #26376 from kamipo/remove_polymorphic_base_class_for_arrayRafael França2016-12-291-3/+0
|\ | | | | Remove extracting `polymorphic_base_class` for `Array` in `AssociationQueryValue`
| * Remove extracting `polymorphic_base_class` for `Array` in ↵Ryuta Kamizono2016-09-211-3/+0
| | | | | | | | | | | | `AssociationQueryValue` It is handled by `PolymorphicArrayValue`.
* | Fix Rubocop violations and fix documentation visibilityRafael Mendonça França2016-12-281-98/+98
| | | | | | | | | | | | Some methods were added to public API in 5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of the public API.
* | Privatize unneededly protected methods in Active RecordAkira Matsuda2016-12-242-13/+11
| |
* | No need to nodoc private methodsAkira Matsuda2016-12-241-1/+1
| |
* | Describe what we are protectingAkira Matsuda2016-12-238-0/+16
| |
* | Translate numeric value out of range to the specific exceptionRyuta Kamizono2016-12-061-4/+4
| | | | | | | | Raise `ActiveRecord::RangeError` when values that executed are out of range.
* | Restore RecordNotFound when *_ids= can't find records by IDDominic Cleal2016-11-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 9c9fb19 changed the behaviour of the _ids= setters for associations to raise an AssociationTypeMismatch when unknown IDs are given: Class: <ActiveRecord::AssociationTypeMismatch> Message: <"Developer(#43811860) expected, got NilClass(#16732720)"> This restores the original ActiveRecord::RecordNotFound exception with a much clearer error message: Class: <ActiveRecord::RecordNotFound> Message: <"Couldn't find all Developers with 'id': (1, -9999) [WHERE \"contracts\".\"company_id\" = ?] (found 1 results, but was looking for 2)"> Fixes #25719
* | Merge pull request #26981 from kamipo/should_not_except_order_for_existsRafael França2016-11-171-1/+1
|\ \ | | | | | | Should except `:distinct` rather than `:order` for `exists?`
| * | Should except `:distinct` rather than `:order` for `exists?`Ryuta Kamizono2016-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Records fetching order is very important for performance if `limit` is presented. Should not except the order in the case. And `exists?` replaces select list to `1 AS one` therefore `:distinct` is useless (`DISTINCT 1 AS one`). And PostgreSQL raises the following error if `:distinct` and `:order` are used in the same time. ``` ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list ```
* | | Call `spawn` and bang method for `none`Ryuta Kamizono2016-11-141-1/+1
|/ / | | | | | | All query methods calls `spawn` and bang method, but only `none` is not.
* | Avoid `unscope(:order)` when `limit_value` is presented for `count`Ryuta Kamizono2016-11-061-6/+6
| | | | | | | | | | If `limit_value` is presented, records fetching order is very important for performance. Should not unscope the order in the case.
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
| |
* | removes requires already present in active_support/railsXavier Noria2016-10-271-2/+0
| |
* | let Regexp#match? be globally availableXavier Noria2016-10-272-2/+0
| | | | | | | | | | | | Regexp#match? should be considered to be part of the Ruby core library. We are emulating it for < 2.4, but not having to require the extension is part of the illusion of the emulation.
* | Fix regression caused due to removal of select method from CollectionAssociationPrathamesh Sonpatki2016-10-221-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - CollectionAssociation#select was removed in https://github.com/rails/rails/pull/25989 in favor of QueryMethods#select but it caused a regression when passing arguments to select and a block. - This used to work earlier in Rails 4.2 and Rails 5. See gist https://gist.github.com/prathamesh-sonpatki/a7df922273473a77dfbc742a4be4b618. - This commit restores the behavior of Rails 4.2 and Rails 5.0.0 to allow passing arguments and block at the same time but also deprecates it. - Because, these arguments do not have any effect on the output of select when select is used with a block. - Updated documentation to remove the example passing arguments and block at the same time to `CollectionProxy#select`.
* | Merge pull request #26598 from ↵Eileen M. Uchitelle2016-10-151-2/+2
|\ \ | | | | | | | | | | | | rutaka-n/raise_record_not_found_with_correct_params initialize errors with name of class and other params
| * | initialize errors with name of class and other paramsv.promzelev2016-09-231-2/+2
| |/
* | Use attribute_names over column_namesKeenan Brock2016-10-041-6/+2
| |
* | Fix doc format for `RecordFetchWarning` [ci skip]Ryuta Kamizono2016-09-271-3/+3
|/
* Merge pull request #26447 from kamipo/reduce_array_allocationSantiago Pastorino2016-09-191-3/+1
|\ | | | | Reduce array allocation when `where` with passed hash
| * Reduce array allocation when `where` with passed hashRyuta Kamizono2016-09-101-3/+1
| | | | | | | | | | In most case `where` is called with passed hash. In the case initializing `binds` is unnecessary.
* | Merge pull request #26446 from kamipo/rename_type_var_name_to_typeEileen M. Uchitelle2016-09-171-10/+8
|\ \ | | | | | | Rename variable name that returning `type_for` to `type` from `column`
| * | Rename variable name that returning `type_for` to `type` from `column`Ryuta Kamizono2016-09-111-10/+8
| |/ | | | | | | | | | | `column_for` was changed to `type_for` to return `type` object at 36bd52b4. But variable name is still `column`. It is very confusing. Rename variable name `column` to `type` for readability.
* / Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-142-23/+23
|/ | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* Fix Remaining Case-In-Assignment Statement FormattingAlex Kitchens2016-09-061-5/+6
| | | | | | | | | Recently, the Rails team made an effort to keep the source code consistent, using Ruboco (bb1ecdcc677bf6e68e0252505509c089619b5b90 and below). Some of the case statements were missed. This changes the case statements' formatting and is consistent with changes in 810dff7c9fa9b2a38eb1560ce0378d760529ee6b and db63406cb007ab3756d2a96d2e0b5d4e777f8231.
* Remove not used alias methodyui-knk2016-09-061-1/+0
| | | | | Bang methods of `AR::QueryMethods` are used only internally. We only use `left_outer_joins!`, so we can remove this alias.
* Fix broken heredoc indentation caused by rubocop auto-correctRyuta Kamizono2016-09-032-6/+6
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But heredocs was still kept absolute position. This commit aligns heredocs indentation for consistency.
* Revert "Extract `PredicateBuilder::CaseSensitiveHandler`"Sean Griffin2016-08-313-41/+10
| | | | | | | | | This reverts commit 3a1f6fe7b4a70bf0698b0684dd48ac712c6883b6. This commit takes the code in a direction that I am looking to avoid. The predicate builder should be purely concerned with AST construction as it matters to methods like `where`. Things like case sensitivity should continue to be handled elsewhere.
* Override `respond_to_missing?` instead of `respond_to?` when possibleSean Griffin2016-08-311-1/+1
| | | | | | | | | | This was almost every case where we are overriding `respond_to?` in a way that mirrors a parallel implementation of `method_missing`. There is one remaining case in Active Model that should probably do the same thing, but had a sufficiently strange implementation that I want to investigate it separately. Fixes #26333.
* Add `Type.default_value` and use it everywhere for internalRyuta Kamizono2016-08-262-3/+3
| | | | For reduce instantiating `Type::Value`.
* Merge pull request #26182 from bogdan/remove-relation-metaprogrammingRafael França2016-08-232-84/+53
|\ | | | | Remove over meta programming in AR::Relation
| * Remove over meta programming in AR::RelationBogdan Gusiev2016-08-232-84/+53
| | | | | | | | | | | | | | | | | | | | Introduced low level methods #set_value and #get_value for setting query attributes: relation.set_value(:where, {id: 1}) relation.get_value(:includes) Used those internally when working with relation's attributes at the abstract level
* | Remove unnecessary ordinal methods for collection associationRyuta Kamizono2016-08-181-2/+10
| | | | | | | | | | Currently `CollectionProxy` inherits `Relation` therefore we can use its own methods rather than delegating to collection association.
* | Merge pull request #25976 from kamipo/pluck_uses_loaded_targetRafael França2016-08-171-1/+1
|\ \ | | | | | | `pluck` should use `records` (`load_target`) when `loaded?` is true
| * | `pluck` should use `records` (`load_target`) when `loaded?` is trueRyuta Kamizono2016-08-041-1/+1
| | |
* | | Fix indentationRafael Mendonça França2016-08-171-3/+3
| | |
* | | Merge pull request #25987 from aquajach/masterRafael Mendonça França2016-08-171-1/+1
|\ \ \ | | | | | | | | | | | | Fix does_not_support_reverse? to find sql functions with commas in nested brackets
| * | | check if order contains comma first in does_not_support_reverse?Jack Chen Songyong2016-07-291-1/+1
| | | |
| * | | have does_not_support_reverse? support sql functions with commas in nested ↵Jack2016-07-291-1/+1
| |/ / | | | | | | | | | brackets