diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2019-01-14 21:53:13 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2019-01-17 16:08:32 -0500 |
commit | a7becf147afc85c354e5cfa519911a948d25fc4d (patch) | |
tree | cb6349d64c67d58e691600717493d13fb8a89cb8 /activerecord | |
parent | f59b08119bc0c01a00561d38279b124abc82561b (diff) | |
download | rails-a7becf147afc85c354e5cfa519911a948d25fc4d.tar.gz rails-a7becf147afc85c354e5cfa519911a948d25fc4d.tar.bz2 rails-a7becf147afc85c354e5cfa519911a948d25fc4d.zip |
Remove delegation of missing methods in a relation to private methods of the class
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG.md | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/delegation.rb | 5 | ||||
-rw-r--r-- | activerecord/test/cases/scoping/named_scoping_test.rb | 7 |
3 files changed, 4 insertions, 12 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 3704ca7a14..d6279cd541 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Remove delegation of missing methods in a relation to private methods of the class. + + *Rafael Mendonça França* + * Deprecate `config.activerecord.sqlite3.represent_boolean_as_integer`. *Rafael Mendonça França* diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb index 6f67dd3784..2055b1637a 100644 --- a/activerecord/lib/active_record/relation/delegation.rb +++ b/activerecord/lib/active_record/relation/delegation.rb @@ -112,11 +112,6 @@ module ActiveRecord if @klass.respond_to?(method) self.class.delegate_to_scoped_klass(method) scoping { @klass.public_send(method, *args, &block) } - elsif @delegate_to_klass && @klass.respond_to?(method, true) - ActiveSupport::Deprecation.warn \ - "Delegating missing #{method} method to #{@klass}. " \ - "Accessibility of private/protected class methods in :scope is deprecated and will be removed in Rails 6.0." - @klass.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." diff --git a/activerecord/test/cases/scoping/named_scoping_test.rb b/activerecord/test/cases/scoping/named_scoping_test.rb index f707951a16..418a2ae04e 100644 --- a/activerecord/test/cases/scoping/named_scoping_test.rb +++ b/activerecord/test/cases/scoping/named_scoping_test.rb @@ -303,13 +303,6 @@ class NamedScopingTest < ActiveRecord::TestCase assert_equal "lifo", topic.author_name end - def test_deprecated_delegating_private_method - assert_deprecated do - scope = Topic.all.by_private_lifo - assert_not scope.instance_variable_get(:@delegate_to_klass) - end - end - def test_reserved_scope_names klass = Class.new(ActiveRecord::Base) do self.table_name = "topics" |