diff options
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index b2f741026b..a98b650524 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -270,17 +270,13 @@ module ActiveRecord manager = association.join_to(manager) end - if Arel::Table === manager - manager.from(join_ast || manager) + if manager.froms.length > 0 && join_ast + join_ast.left = manager.froms.first + manager.from join_ast + elsif manager.froms.length == 0 && join_ast + manager.from(join_ast) else - if manager.froms.length > 0 && join_ast - join_ast.left = manager.froms.first - manager.from join_ast - elsif manager.froms.length == 0 && join_ast - manager.from(join_ast) - else - manager - end + manager end end |