1
0
Fork 0
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:
Rafael Mendonça França 2019-01-14 22:04:22 -05:00
parent a7becf147a
commit d97980a16d
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
3 changed files with 4 additions and 20 deletions

View file

@ -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*

View file

@ -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

View file

@ -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