diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-03-07 19:07:07 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-03-07 19:11:43 +0900 |
commit | 8309706239769c429bbd323ba4d36d8ef10bb2f1 (patch) | |
tree | 14cf578ac7c4eecb10492c7ee6c3a79ca4873ff1 /activerecord/test/cases/relation | |
parent | a88b6f257b7c0df816181ce2c36bb7ecb6487a17 (diff) | |
download | rails-8309706239769c429bbd323ba4d36d8ef10bb2f1.tar.gz rails-8309706239769c429bbd323ba4d36d8ef10bb2f1.tar.bz2 rails-8309706239769c429bbd323ba4d36d8ef10bb2f1.zip |
Delegate `only` query method to relation as with `except`
I've found the skewness of delegation methods between `except` and
`only` in a88b6f2.
The `only` method is closely similar with `except` as `SpawnMethods`.
https://github.com/rails/rails/blob/e056b9bfb07c4eb3bcc6672d885aadd72bec574f/activerecord/lib/active_record/relation/spawn_methods.rb#L53-L67
It is preferable both behaves the same way.
Diffstat (limited to 'activerecord/test/cases/relation')
-rw-r--r-- | activerecord/test/cases/relation/delegation_test.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/test/cases/relation/delegation_test.rb b/activerecord/test/cases/relation/delegation_test.rb index d04c409cb5..172fa20bc3 100644 --- a/activerecord/test/cases/relation/delegation_test.rb +++ b/activerecord/test/cases/relation/delegation_test.rb @@ -48,7 +48,7 @@ module ActiveRecord ActiveRecord::Batches.public_instance_methods(false) + ActiveRecord::Calculations.public_instance_methods(false) + ActiveRecord::FinderMethods.public_instance_methods(false) - [:raise_record_not_found_exception!] + - ActiveRecord::SpawnMethods.public_instance_methods(false) - [:spawn, :merge!, :only] + + ActiveRecord::SpawnMethods.public_instance_methods(false) - [:spawn, :merge!] + ActiveRecord::QueryMethods.public_instance_methods(false).reject { |method| method.to_s.end_with?("=", "!", "value", "values", "clause") } - [:reverse_order, :arel, :extensions] + [ |