From 1a723c65bbe91ad969b67416233d20eff6d2a46a Mon Sep 17 00:00:00 2001
From: Ryuta Kamizono <kamipo@gmail.com>
Date: Fri, 25 Aug 2017 16:36:55 +0900
Subject: Should work inverse association when eager loading

This regression was caused by caa178c1. The block for
`set_inverse_instance` should also be passed to join dependency.

Fixes #30402.
---
 activerecord/test/cases/associations/eager_test.rb | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'activerecord/test')

diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index 1f5f9eddb5..44bf7f7d2f 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -40,6 +40,12 @@ class EagerAssociationTest < ActiveRecord::TestCase
     assert_nil member.favourite_club
   end
 
+  def test_should_work_inverse_of_with_eager_load
+    author = authors(:david)
+    assert_same author, author.posts.first.author
+    assert_same author, author.posts.eager_load(:comments).first.author
+  end
+
   def test_loading_with_one_association
     posts = Post.all.merge!(includes: :comments).to_a
     post = posts.find { |p| p.id == 1 }
-- 
cgit v1.2.3