aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-07-07 13:38:54 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-07-07 13:40:50 -0300
commit1b4399dfe7eaa8dd2a75f35815ea429962c51a29 (patch)
treebdab5581deb27dda70a0a034535fe42667a01c20 /activerecord/lib
parent4cc5917dce83fb841ac78b250ef3d1024168eb1e (diff)
downloadrails-1b4399dfe7eaa8dd2a75f35815ea429962c51a29.tar.gz
rails-1b4399dfe7eaa8dd2a75f35815ea429962c51a29.tar.bz2
rails-1b4399dfe7eaa8dd2a75f35815ea429962c51a29.zip
Fix regression caused by a01d164b
When preload is used in a default scope the preload_values were returning nested arrays and causing the preloader to fail because it doesn't know how to deal with nested arrays. So before calling preload! we need to splat the arguments. This is not needed to includes because it flatten its arguments.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation/merger.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/merger.rb b/activerecord/lib/active_record/relation/merger.rb
index dd8f0aa298..0b38666ce9 100644
--- a/activerecord/lib/active_record/relation/merger.rb
+++ b/activerecord/lib/active_record/relation/merger.rb
@@ -87,8 +87,8 @@ module ActiveRecord
return if other.preload_values.empty? && other.includes_values.empty?
if other.klass == relation.klass
- relation.preload! other.preload_values unless other.preload_values.empty?
- relation.includes! other.includes_values unless other.includes_values.empty?
+ relation.preload!(*other.preload_values) unless other.preload_values.empty?
+ relation.includes!(other.includes_values) unless other.includes_values.empty?
else
reflection = relation.klass.reflect_on_all_associations.find do |r|
r.class_name == other.klass.name