aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/alias_tracker.rb
diff options
context:
space:
mode:
authorMatt Jones <al2o3cr@gmail.com>2014-05-16 15:55:44 -0400
committerMatt Jones <al2o3cr@gmail.com>2014-05-16 15:55:44 -0400
commitc917fb7c35c8ef0f48963f44059e7088430bb2d0 (patch)
tree3832fc2422b7872d3f252b4578c765c7936cb5bb /activerecord/lib/active_record/associations/alias_tracker.rb
parent654be5f042bae666c0e502b5d24fbf7e4fdf2892 (diff)
downloadrails-c917fb7c35c8ef0f48963f44059e7088430bb2d0.tar.gz
rails-c917fb7c35c8ef0f48963f44059e7088430bb2d0.tar.bz2
rails-c917fb7c35c8ef0f48963f44059e7088430bb2d0.zip
WIP: pass existing joins to construct_join_dependency
Diffstat (limited to 'activerecord/lib/active_record/associations/alias_tracker.rb')
-rw-r--r--activerecord/lib/active_record/associations/alias_tracker.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/alias_tracker.rb b/activerecord/lib/active_record/associations/alias_tracker.rb
index 85109aee6c..a6a1947148 100644
--- a/activerecord/lib/active_record/associations/alias_tracker.rb
+++ b/activerecord/lib/active_record/associations/alias_tracker.rb
@@ -32,8 +32,18 @@ module ActiveRecord
join.left.downcase.scan(
/join(?:\s+\w+)?\s+(\S+\s+)?#{quoted_name}\son/
).size
- else
+ elsif join.respond_to? :left
join.left.table_name == name ? 1 : 0
+ else
+ # this branch is reached by two tests:
+ #
+ # activerecord/test/cases/associations/cascaded_eager_loading_test.rb:37
+ # with :posts
+ #
+ # activerecord/test/cases/associations/eager_test.rb:1133
+ # with :comments
+ #
+ 0
end
end