diff options
author | Byron Bischoff <byronb@gmail.com> | 2014-10-22 11:39:47 -0700 |
---|---|---|
committer | Byron Bischoff <byronb@gmail.com> | 2014-10-22 11:39:47 -0700 |
commit | 0f3cefa445c6b43711b29f38257adcedede74baa (patch) | |
tree | 55fd8cdd4380f478f4697f3e2ef82c088e3d0850 /activerecord/lib | |
parent | 19d698d2b45ca33d8709c1993e39d7d9df284e3d (diff) | |
download | rails-0f3cefa445c6b43711b29f38257adcedede74baa.tar.gz rails-0f3cefa445c6b43711b29f38257adcedede74baa.tar.bz2 rails-0f3cefa445c6b43711b29f38257adcedede74baa.zip |
copy reflection_scopes’s unscoped value when building scope for preloading, fixes #11036
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/preloader/association.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index c0639742be..2300435f91 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -136,6 +136,10 @@ module ActiveRecord preload_values = preload_scope.values preload_binds = preload_scope.bind_values + if values[:unscope] + scope.unscope! values[:unscope] + end + scope.where_values = Array(values[:where]) + Array(preload_values[:where]) scope.references_values = Array(values[:references]) + Array(preload_values[:references]) scope.bind_values = (reflection_binds + preload_binds) |