From 3c4aa73ce8ea3dd8deb6025bc62382c1e9c870f3 Mon Sep 17 00:00:00 2001
From: Matt Todd <chiology@gmail.com>
Date: Mon, 19 Oct 2015 02:03:29 -0700
Subject: Make inherited scope test fail

This triggers the JoinDependency work to reflect on the associations
and trigger an error as follows:

  ActiveRecord::ConfigurationError: Association named 'account' was
  not found on Company; perhaps you misspelled it?

Fix Company.of_first_firm joins association name

Should be `Company.joins(:accounts)` not `Company.joins(:account)`.

Do the same for Client.of_first_firm
---
 activerecord/test/cases/inheritance_test.rb | 4 ++--
 activerecord/test/models/company.rb         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'activerecord')

diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb
index f67d85603a..2d939dc3d7 100644
--- a/activerecord/test/cases/inheritance_test.rb
+++ b/activerecord/test/cases/inheritance_test.rb
@@ -352,8 +352,8 @@ class InheritanceTest < ActiveRecord::TestCase
   end
 
   def test_scope_inherited_properly
-    assert_nothing_raised { Company.of_first_firm }
-    assert_nothing_raised { Client.of_first_firm }
+    assert_nothing_raised { Company.of_first_firm.to_sql }
+    assert_nothing_raised { Client.of_first_firm.to_sql }
   end
 end
 
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb
index 1dcd9fc21e..dd890909ab 100644
--- a/activerecord/test/models/company.rb
+++ b/activerecord/test/models/company.rb
@@ -12,7 +12,7 @@ class Company < AbstractCompany
   has_many :developers, :through => :contracts
 
   scope :of_first_firm, lambda {
-    joins(:account => :firm).
+    joins(:accounts => :firm).
     where('firms.id' => 1)
   }
 
-- 
cgit v1.2.3