Class: ActiveRecord::Associations::HasAndBelongsToManyAssociation

Inherits:
AssociationCollection show all
Defined in:
activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb

Overview

:nodoc:

Instance Attribute Summary (collapse)

Attributes inherited from AssociationProxy

#target

Instance Method Summary (collapse)

Methods inherited from AssociationCollection

#<<, #any?, #build, #clear, #count, #create, #create!, #delete, #delete_all, #destroy, #destroy_all, #empty?, #find, #first, #include?, #last, #length, #many?, #method_missing, #replace, #reset, #respond_to?, #select, #size, #sum, #to_ary, #transaction, #uniq

Methods inherited from AssociationProxy

#===, #aliased_table_name, #inspect, #loaded!, #loaded?, #method_missing, #proxy_owner, #proxy_reflection, #reload, #reset, #respond_to?, #scoped, #send, #stale_target?, #to_param

Constructor Details

- (HasAndBelongsToManyAssociation) initialize(owner, reflection)

A new instance of HasAndBelongsToManyAssociation



7
8
9
10
# File 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb', line 7

def initialize(owner, reflection)
  @join_table = Arel::Table.new(reflection.options[:join_table])
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveRecord::Associations::AssociationCollection

Instance Attribute Details

- (Object) join_table (readonly)

Returns the value of attribute join_table



5
6
7
# File 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb', line 5

def join_table
  @join_table
end