aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/join_dependency.rb
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2014-12-29 14:12:39 -0500
committereileencodes <eileencodes@gmail.com>2015-01-02 17:15:31 -0500
commit39abe8355a56992b32ed95e1ea1eb588c0ad7a6f (patch)
tree2bfe201902af343eaa67e1ec2f97dff3d18c7df4 /activerecord/lib/active_record/associations/join_dependency.rb
parent96e277c03b7e62e33858ea9e254c9ed88625778f (diff)
downloadrails-39abe8355a56992b32ed95e1ea1eb588c0ad7a6f.tar.gz
rails-39abe8355a56992b32ed95e1ea1eb588c0ad7a6f.tar.bz2
rails-39abe8355a56992b32ed95e1ea1eb588c0ad7a6f.zip
Move `#type_caster` to alias tracker initialize
This moves the `#type_caster` from the `aliased_table_for` and into the initialize of the `alias_tracker`.
Diffstat (limited to 'activerecord/lib/active_record/associations/join_dependency.rb')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index 634abfac96..4b75370171 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -93,7 +93,7 @@ module ActiveRecord
# joins # => []
#
def initialize(base, associations, joins)
- @alias_tracker = AliasTracker.create_with_joins(base.connection, base.table_name, joins)
+ @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 }
@@ -185,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