aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation/delegation_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Permit list usage cleanup and clearer documentationKevin Deisz2018-08-271-3/+3
|
* Convert remaining usage of whitelist and blacklistKevin Deisz2018-08-241-3/+3
|
* Add `QueryingMethodsDelegationTest` to cover query methods delegationRyuta Kamizono2018-03-221-0/+28
| | | | | It makes to ease to detect a future regression as long as the methods are covered by this test.
* Merge pull request #30377 from keepcosmos/delegate-missing-methodsMatthew Draper2017-08-311-2/+2
|\ | | | | Delegate :rindex, :slice, :rotate(missing) to 'records'
| * Delegate :rindex, :slice, :rotate to 'records'keepcosmos2017-08-241-2/+2
| |
* | Should be appear deprecation message for every call (#29649)Ryuta Kamizono2017-08-271-0/+1
| | | | | | Context: https://github.com/rails/rails/pull/29619#discussion_r125158589
* | Remove unnecessary fixture loadingRyuta Kamizono2017-08-241-5/+1
|/
* Fix failing testsSean Griffin2017-07-251-1/+1
| | | | `bind_values` was removed from Arel
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Deprecate delegating to `arel` in `Relation`Ryuta Kamizono2017-06-291-0/+15
| | | | | | | | | | | | | Active Record doesn't rely delegating to `arel` in the internal since 425f2ca. The delegation is a lower priority than delegating to `klass`, so it is pretty unclear which method is delegated to `arel`. For example, `bind_values` method was removed at b06f64c (a series of changes https://github.com/rails/rails/compare/79f71d3...b06f64c). But a relation still could respond to the method because `arel` also have the same named method (#28976). Removing the delegation will achieve predictable behavior.
* Remove unused `DelegationTest#call_method`Ryuta Kamizono2017-05-061-27/+7
| | | | `DelegationTest#call_method` is no longer used since 9d79334a.
* Simply delegate `as_json` to `records`Ryuta Kamizono2017-03-101-1/+1
|
* Delegate `to_sentence` and `to_fomatted_s` to `records`kenta-s2017-02-041-1/+2
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-3/+3
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Ensure `Relation` responds to `shuffle`Sean Griffin2015-12-011-1/+1
| | | | | It appears that I missed this one when I delegated all the non-mutation array methods that were not on Enumerable
* Remove blanket array delegation from `Relation`Sean Griffin2015-11-231-6/+0
| | | | | | | | | As was pointed out by #17128, our blacklist of mutation methods was non-exhaustive (and would need to be kept up to date with each new version of Ruby). Now that `Relation` includes `Enumerable`, the number of methods that we actually need to delegate are pretty small. As such, we can change to explicitly delegating the few non-mutation related methods that `Array` has which aren't on `Enumerable`
* Add test to 57daaefRafael Mendonça França2015-05-281-1/+1
|
* Put back Relation#join method as a delegate to ArrayBogdan Gusiev2014-05-051-1/+1
| | | | | | | | This is a regression 4.0 -> 4.1 fix. In 4.1.0 Relation#join is delegated to Arel#SelectManager. In 4.0 series it is delegated to Array#join This patch puts back the behaviour of 4.0
* Create a blacklist to disallow mutator methods to be delegated to `Array`.Lauro Caetano2013-12-171-4/+11
| | | | | | | | This change was necessary because the whitelist wouldn't work. It would be painful for users trying to update their applications. This blacklist intent to prevent odd bugs and confusion in code that call mutator methods directely on the `Relation`.
* Add a bunch of Relation -> Array delegate methods to the whitelist. This ↵Jeremy Kemper2013-12-121-28/+14
| | | | won't last - aim to switch back to a blacklist for mutator methods.
* Use `public_send` instead of just use `send`.Lauro Caetano2013-12-121-4/+4
|
* Use a whitelist to delegate methods to arrayLauro Caetano2013-12-121-57/+32
|
* `delgated` => `delegated`Akshay Vishnoi2013-11-251-4/+4
|
* Avoid sorting an Array including objects from different ClassesAkira Matsuda2013-11-111-1/+1
| | | | addresses "ArgumentError: comparison of VerySpecialComment with SpecialComment failed" in ActiveRecord::DelegationRelationTest#test_#sort!_delegation_is_deprecated
* Load test fixtures where data are neededAkira Matsuda2013-11-111-0/+2
| | | | Without this, some tests here were not actually testing anything.
* A tiny grammatical fixAkira Matsuda2013-11-111-1/+1
| | | | [ci skip]
* Allow methods arity below -1 in assert_responds.Federico Ravasio2013-10-081-3/+4
| | | | | | | | Every method from MRI's core classes is written in C. This means Method#arity always returns -1 for methods with a variable number of arguments. This is not the case with Rubinius, where, for example Array#slice! is implemented in Ruby and has arity -2, since is defined as def slice!(start, length = undefined)
* Deprecate the delegation of Array bang methods in ActiveRecord::DelegationBen Woosley2013-09-041-0/+97
The primary means of returning results for Array bang methods is to modify the array in-place. When you call these methods on a relation, that array is created, modified, and then thrown away. Only the secondary return value is exposed to the caller. Removing this delegation is a straight-forward way to reduce user error by forcing callers to first explicitly call #to_a in order to expose the array to be acted on by the bang method.