From 5243946017d09afff4d70d273b0fcdfd41a4b22a Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Thu, 29 Oct 2015 10:15:37 -0600 Subject: Revert "Merge pull request #22026 from akihiro17/fix-preload-association" This reverts commit 6dc6a0b17cfaf7cb6aa2b1c163b6ca141b538a8e, reversing changes made to ec94f00ba3cf250eb54fc5b7a5e3ed4b90164f34. This pull request broke the build. --- activerecord/CHANGELOG.md | 6 ------ .../associations/preloader/association.rb | 4 ---- activerecord/test/cases/associations/eager_test.rb | 18 ------------------ 3 files changed, 28 deletions(-) diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 614cee4449..86738fa819 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,9 +1,3 @@ -* Set `scope.reordering_value` to `true` if :reordering values are specified. - - Fixes #21886. - - *Hiroaki Izu* - * Add support for bidirectional destroy dependencies. Fixes #13609. diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index c43f13f3c4..29dd0643d6 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -136,10 +136,6 @@ module ActiveRecord end scope.order! preload_values[:order] || values[:order] - if preload_values[:reordering] || values[:reordering] - scope.reordering_value = true - end - if preload_values[:readonly] || values[:readonly] scope.readonly! end diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 628ea1c764..bc1bff79d3 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -1179,24 +1179,6 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_equal 1, mary.unique_categorized_post_ids.length end - def test_preloading_has_one_using_reorder - klass = Class.new(ActiveRecord::Base) do - def self.name; "TempAuthor"; end - self.table_name = "authors" - has_one :post, class_name: "PostWithDefaultScope", foreign_key: :author_id - has_one :reorderd_post, -> { reorder(title: :desc) }, class_name: "PostWithDefaultScope", foreign_key: :author_id - end - - author = klass.first - # PRECONDITION: make sure ordering results in different results - assert_not_equal author.post, author.reorderd_post - - preloaded_reorderd_post = klass.preload(:reorderd_post).first.reorderd_post - - assert_equal author.reorderd_post, preloaded_reorderd_post - assert_equal posts(:sti_post_and_comments).title, preloaded_reorderd_post.title - end - def test_preloading_polymorphic_with_custom_foreign_type sponsor = sponsors(:moustache_club_sponsor_for_groucho) groucho = members(:groucho) -- cgit v1.2.3