method

new

Importance_0
v2.2.1 - Show latest stable - 0 notes - Class: ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation
new(reflection, join_dependency, parent = nil) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations.rb, line 2016
            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)

              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
Register or log in to add new notes.