method
new
v3.0.9 -
Show latest stable
-
0 notes -
Class: ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation
new(reflection, join_dependency, parent = nil)
public
Hide source
# File activerecord/lib/active_record/associations.rb, line 2100 def initialize(reflection, join_dependency, parent = nil) reflection.check_validity! if reflection.options[:polymorphic] raise EagerLoadPolymorphicError.new(reflection) end super(reflection.klass) @join_dependency = join_dependency @parent = parent @reflection = reflection @aliased_prefix = "t#{ join_dependency.joins.size }" @parent_table_name = parent.active_record.table_name @aliased_table_name = aliased_table_name_for(table_name) @join = nil @join_type = Arel::InnerJoin if reflection.macro == :has_and_belongs_to_many @aliased_join_table_name = aliased_table_name_for(reflection.options[:join_table], "_join") end if [:has_many, :has_one].include?(reflection.macro) && reflection.options[:through] @aliased_join_table_name = aliased_table_name_for(reflection.through_reflection.klass.table_name, "_join") end end