diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-03 22:11:39 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-04 22:55:16 +0900 |
commit | 652258e41a882acccdb9a3ce211dbf356e738b28 (patch) | |
tree | 3d35a5e75e5ac0ba5be027aa8b341238f3902d40 /activerecord/test/cases/associations | |
parent | 092c547d7fca936c7a1fe39a1bdca6bc8d98940c (diff) | |
download | rails-652258e41a882acccdb9a3ce211dbf356e738b28.tar.gz rails-652258e41a882acccdb9a3ce211dbf356e738b28.tar.bz2 rails-652258e41a882acccdb9a3ce211dbf356e738b28.zip |
Fix newly added reflection order when redefining association
Currently reflections keeps the order when first added even if when
redefining association. As a result of the order, redefining through
association which use newly added association will raise
`HasManyThroughOrderError`. We need to redefine reflection order as well
when redefining association.
Fixes #31068.
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 2649dc010f..9830917bc3 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -787,7 +787,7 @@ class EagerAssociationTest < ActiveRecord::TestCase Tagging.create!(taggable_type: "Post", taggable_id: post2.id, tag: tag) tag_with_includes = OrderedTag.includes(:tagged_posts).find(tag.id) - assert_equal(tag_with_includes.taggings.map(&:taggable).map(&:title), tag_with_includes.tagged_posts.map(&:title)) + assert_equal tag_with_includes.ordered_taggings.map(&:taggable).map(&:title), tag_with_includes.tagged_posts.map(&:title) end def test_eager_has_many_through_multiple_with_order |