Skip to content

Commit

Permalink
Remove delegation of missing methods in a relation to private methods…
Browse files Browse the repository at this point in the history
… of the class
  • Loading branch information
rafaelfranca committed Jan 17, 2019
1 parent f59b081 commit a7becf1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
4 changes: 4 additions & 0 deletions activerecord/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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*
Expand Down
5 changes: 0 additions & 5 deletions activerecord/lib/active_record/relation/delegation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +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 @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."
Expand Down
7 changes: 0 additions & 7 deletions activerecord/test/cases/scoping/named_scoping_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,6 @@ def test_should_build_on_top_of_chained_scopes
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"
Expand Down

0 comments on commit a7becf1

Please sign in to comment.