Skip to content

Commit

Permalink
Remove deprecated methd #scope_chain
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Oct 23, 2017
1 parent e1066f4 commit ef77847
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 44 deletions.
4 changes: 4 additions & 0 deletions activerecord/CHANGELOG.md
@@ -1,3 +1,7 @@
* Remove deprecated method `#scope_chain`.

*Rafael Mendonça França*

* Remove deprecated configuration `.error_on_ignored_order_or_limit`. * Remove deprecated configuration `.error_on_ignored_order_or_limit`.


*Rafael Mendonça França* *Rafael Mendonça França*
Expand Down
6 changes: 0 additions & 6 deletions activerecord/lib/active_record/reflection.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true


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


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


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

def build_join_constraint(table, foreign_table) def build_join_constraint(table, foreign_table)
key = join_keys.key key = join_keys.key
foreign_key = join_keys.foreign_key foreign_key = join_keys.foreign_key
Expand Down
38 changes: 0 additions & 38 deletions activerecord/test/cases/reflection_test.rb
Expand Up @@ -253,32 +253,6 @@ def test_chain
assert_equal expected, actual assert_equal expected, actual
end 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 def test_scope_chain_does_not_interfere_with_hmt_with_polymorphic_case
@hotel = Hotel.create! @hotel = Hotel.create!
@department = @hotel.departments.create! @department = @hotel.departments.create!
Expand Down Expand Up @@ -415,18 +389,6 @@ def test_foreign_key
assert_equal "category_id", Post.reflect_on_association(:categorizations).foreign_key.to_s assert_equal "category_id", Post.reflect_on_association(:categorizations).foreign_key.to_s
end 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 def test_symbol_for_class_name
assert_equal Client, Firm.reflect_on_association(:unsorted_clients_with_symbol).klass assert_equal Client, Firm.reflect_on_association(:unsorted_clients_with_symbol).klass
end end
Expand Down

0 comments on commit ef77847

Please sign in to comment.