aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/reflection.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2017-08-01 17:34:14 -0400
committerRafael Mendonça França <rafaelmfranca@gmail.com>2017-08-01 17:34:14 -0400
commitfeb1ddae021c38174f9c22bbd1298c8b73431b45 (patch)
tree09a38695596cf80dc362dd4d93cf94d6f7415e7b /activerecord/lib/active_record/reflection.rb
parent3540e60c385286f3517ff56270b31a91ed3024a3 (diff)
parentf9a43f28c087f8ffd35ff7c33a60c938b60f2be2 (diff)
downloadrails-feb1ddae021c38174f9c22bbd1298c8b73431b45.tar.gz
rails-feb1ddae021c38174f9c22bbd1298c8b73431b45.tar.bz2
rails-feb1ddae021c38174f9c22bbd1298c8b73431b45.zip
Merge remote-tracking branch 'origin/master' into unlock-minitest
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r--activerecord/lib/active_record/reflection.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index a453ca55c7..efe56454d0 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "thread"
require "active_support/core_ext/string/filters"
require "active_support/deprecation"
@@ -219,10 +221,10 @@ module ActiveRecord
end
def klass_join_scope(table, predicate_builder) # :nodoc:
- if klass.current_scope
- klass.current_scope.clone.tap { |scope|
- scope.joins_values = scope.left_outer_joins_values = [].freeze
- }
+ current_scope = klass.current_scope
+
+ if current_scope && current_scope.empty_scope?
+ build_scope(table, predicate_builder)
else
klass.default_scoped(build_scope(table, predicate_builder))
end