Skip to content
Permalink
Browse files
Remove delegation of missing methods in a relation to arel
  • Loading branch information
rafaelfranca committed Jan 17, 2019
1 parent a7becf1 commit d97980a16d76ad190042b4d8578109714e9c53d0
@@ -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 @@ def method_missing(method, *args, &block)
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 ArrayDelegationTests
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 @@ def target

class DelegationRelationTest < ActiveRecord::TestCase
include ArrayDelegationTests
include DeprecatedArelDelegationTests

def target
Comment.all

0 comments on commit d97980a

Please sign in to comment.