From 6cd9e2bd29b26e1ea781fafce18614217b7adf7b Mon Sep 17 00:00:00 2001
From: Sean Griffin <sean@thoughtbot.com>
Date: Sat, 22 Nov 2014 15:36:50 -0700
Subject: Fix build failures

For some reason changing `.find` to `.unscoped.find` in
https://github.com/rails/rails/commit/f766abd4cf3eb75469d3646cfb6d85e668c619f3
caused `scoping` to leak in some tests when run in isolation (looks like
a concurrency issue?). `relation_scoping_test.rb` is a case that failed.
From what I can tell it should not be possible, but changing to the
block form fixes it. There is a deeper issue that I can't seem to find.
/cc @senny
---
 activerecord/lib/active_record/fixtures.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'activerecord/lib')

diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index 660ba18a98..7c53ee0a9a 100644
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -806,7 +806,9 @@ module ActiveRecord
 
     def find
       if model_class
-        model_class.unscoped.find(fixture[model_class.primary_key])
+        model_class.unscoped do
+          model_class.find(fixture[model_class.primary_key])
+        end
       else
         raise FixtureClassNotFound, "No class attached to find."
       end
-- 
cgit v1.2.3