aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-12-08 10:29:52 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-08 10:29:52 -0800
commit2fd385d47163149ec74029731bc29370fa768735 (patch)
treecdee4618074573aaa38c942db5c08ca5b993f241
parent1d96d44da318faab8d213f330aebcecdbec52f5d (diff)
downloadrails-2fd385d47163149ec74029731bc29370fa768735.tar.gz
rails-2fd385d47163149ec74029731bc29370fa768735.tar.bz2
rails-2fd385d47163149ec74029731bc29370fa768735.zip
reducing use of custom joins
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index df41f756ce..705bf21eae 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -296,7 +296,12 @@ module ActiveRecord
if Arel::Table === relation
relation.from(ast || relation)
else
- relation.join(custom_joins)
+ if relation.froms.length > 0 && ast
+ ast.left = relation.froms.first
+ relation.from ast
+ else
+ relation.join(custom_joins)
+ end
end
end