mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove delegation of missing methods in a relation to arel
This commit is contained in:
parent
a7becf147a
commit
d97980a16d
3 changed files with 4 additions and 20 deletions
|
@ -1,3 +1,7 @@
|
|||
* Remove delegation of missing methods in a relation to arel.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
||||
* Remove delegation of missing methods in a relation to private methods of the class.
|
||||
|
||||
*Rafael Mendonça França*
|
||||
|
|
|
@ -112,10 +112,6 @@ module ActiveRecord
|
|||
if @klass.respond_to?(method)
|
||||
self.class.delegate_to_scoped_klass(method)
|
||||
scoping { @klass.public_send(method, *args, &block) }
|
||||
elsif arel.respond_to?(method)
|
||||
ActiveSupport::Deprecation.warn \
|
||||
"Delegating #{method} to arel is deprecated and will be removed in Rails 6.0."
|
||||
arel.public_send(method, *args, &block)
|
||||
else
|
||||
super
|
||||
end
|
||||
|
|
|
@ -23,23 +23,8 @@ module ActiveRecord
|
|||
end
|
||||
end
|
||||
|
||||
module DeprecatedArelDelegationTests
|
||||
AREL_METHODS = [
|
||||
:with, :orders, :froms, :project, :projections, :taken, :constraints, :exists, :locked, :where_sql,
|
||||
:ast, :source, :join_sources, :to_dot, :create_insert, :create_true, :create_false
|
||||
]
|
||||
|
||||
def test_deprecate_arel_delegation
|
||||
AREL_METHODS.each do |method|
|
||||
assert_deprecated { target.public_send(method) }
|
||||
assert_deprecated { target.public_send(method) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class DelegationAssociationTest < ActiveRecord::TestCase
|
||||
include ArrayDelegationTests
|
||||
include DeprecatedArelDelegationTests
|
||||
|
||||
def target
|
||||
Post.new.comments
|
||||
|
@ -48,7 +33,6 @@ module ActiveRecord
|
|||
|
||||
class DelegationRelationTest < ActiveRecord::TestCase
|
||||
include ArrayDelegationTests
|
||||
include DeprecatedArelDelegationTests
|
||||
|
||||
def target
|
||||
Comment.all
|
||||
|
|
Loading…
Reference in a new issue