Skip to content
Permalink
Browse files

Remove deprecated methd `#scope_chain`

  • Loading branch information...
rafaelfranca committed Sep 15, 2017
1 parent e1066f4 commit ef7784752c5c5efbe23f62d2bbcc62d4fd8aacab
@@ -1,3 +1,7 @@
* Remove deprecated method `#scope_chain`.

*Rafael Mendonça França*

* Remove deprecated configuration `.error_on_ignored_order_or_limit`.

*Rafael Mendonça França*
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "active_support/core_ext/string/filters"
require "active_support/deprecation"
require "concurrent/map"

module ActiveRecord
@@ -174,11 +173,6 @@ def scopes
scope ? [scope] : []
end

def scope_chain
chain.map(&:scopes)
end
deprecate :scope_chain

def build_join_constraint(table, foreign_table)
key = join_keys.key
foreign_key = join_keys.foreign_key
@@ -253,32 +253,6 @@ def test_chain
assert_equal expected, actual
end

def test_scope_chain
expected = [
[Tagging.reflect_on_association(:tag).scope, Post.reflect_on_association(:first_blue_tags).scope],
[Post.reflect_on_association(:first_taggings).scope],
[Author.reflect_on_association(:misc_posts).scope]
]
actual = assert_deprecated do
Author.reflect_on_association(:misc_post_first_blue_tags).scope_chain
end
assert_equal expected, actual

expected = [
[
Tagging.reflect_on_association(:blue_tag).scope,
Post.reflect_on_association(:first_blue_tags_2).scope,
Author.reflect_on_association(:misc_post_first_blue_tags_2).scope
],
[],
[]
]
actual = assert_deprecated do
Author.reflect_on_association(:misc_post_first_blue_tags_2).scope_chain
end
assert_equal expected, actual
end

def test_scope_chain_does_not_interfere_with_hmt_with_polymorphic_case
@hotel = Hotel.create!
@department = @hotel.departments.create!
@@ -415,18 +389,6 @@ def test_foreign_key
assert_equal "category_id", Post.reflect_on_association(:categorizations).foreign_key.to_s
end

def test_through_reflection_scope_chain_does_not_modify_other_reflections
orig_conds = assert_deprecated do
Post.reflect_on_association(:first_blue_tags_2).scope_chain
end.inspect
assert_deprecated do
Author.reflect_on_association(:misc_post_first_blue_tags_2).scope_chain
end
assert_equal orig_conds, assert_deprecated {
Post.reflect_on_association(:first_blue_tags_2).scope_chain
}.inspect
end

def test_symbol_for_class_name
assert_equal Client, Firm.reflect_on_association(:unsorted_clients_with_symbol).klass
end

0 comments on commit ef77847

Please sign in to comment.
You can’t perform that action at this time.