aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/join_dependency.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-02 19:57:26 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-02 19:57:26 -0300
commit2ade177b37c079666efa7705d57519072b8d8215 (patch)
treebe08b8420b50fe9671efbf4cca205a2b25b8dd3c /activerecord/lib/active_record/associations/join_dependency.rb
parenteed68fddee6477ce1e8365d2b495310ef4903621 (diff)
parentb0d87a725af7d2c1e254780fa1052b210bcdec8c (diff)
downloadrails-2ade177b37c079666efa7705d57519072b8d8215.tar.gz
rails-2ade177b37c079666efa7705d57519072b8d8215.tar.bz2
rails-2ade177b37c079666efa7705d57519072b8d8215.zip
Merge pull request #18279 from eileencodes/refactor-association-scope
Refactoring of add_constraints in AssociationScope
Diffstat (limited to 'activerecord/lib/active_record/associations/join_dependency.rb')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index 66e997c3c8..4b75370171 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -93,8 +93,7 @@ module ActiveRecord
# joins # => []
#
def initialize(base, associations, joins)
- @alias_tracker = AliasTracker.create(base.connection, joins)
- @alias_tracker.aliased_table_for(base.table_name, base.table_name, type_caster: base.type_caster) # Updates the count for base.table_name to 1
+ @alias_tracker = AliasTracker.create_with_joins(base.connection, base.table_name, joins, base.type_caster)
tree = self.class.make_tree associations
@join_root = JoinBase.new base, build(tree, base)
@join_root.children.each { |child| construct_tables! @join_root, child }
@@ -186,13 +185,9 @@ module ActiveRecord
def table_aliases_for(parent, node)
node.reflection.chain.map { |reflection|
- if reflection.klass
- type_caster = reflection.klass.type_caster
- end
alias_tracker.aliased_table_for(
reflection.table_name,
- table_alias_for(reflection, parent, reflection != node.reflection),
- type_caster: type_caster,
+ table_alias_for(reflection, parent, reflection != node.reflection)
)
}
end