aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 705bf21eae..3a2cbc8dda 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -299,6 +299,8 @@ module ActiveRecord
if relation.froms.length > 0 && ast
ast.left = relation.froms.first
relation.from ast
+ elsif relation.froms.length == 0 && ast
+ relation.from(ast)
else
relation.join(custom_joins)
end