Class: ActiveRecord::Associations::HasAndBelongsToManyAssociation

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

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from AssociationCollection

#<<, #any?, #build, #clear, #count, #delete, #delete_all, #destroy_all, #empty?, #find, #first, #include?, #initialize, #last, #length, #proxy_respond_to?, #replace, #reset, #size, #sum, #to_ary, #transaction, #uniq

Methods inherited from AssociationProxy

#===, #aliased_table_name, #conditions, #initialize, #inspect, #loaded, #loaded?, #proxy_owner, #proxy_reflection, #proxy_respond_to?, #proxy_target, #reload, #reset, #respond_to?, #send, #target, #target=

Constructor Details

This class inherits a constructor from ActiveRecord::Associations::AssociationCollection

Dynamic Method Handling

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

Instance Method Details

#columnsObject



12
13
14
# File 'lib/active_record/associations/has_and_belongs_to_many_association.rb', line 12

def columns
  @reflection.columns(@reflection.options[:join_table], "#{@reflection.options[:join_table]} Columns")
end

#create(attributes = {}) ⇒ Object



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

def create(attributes = {})
  create_record(attributes) { |record| insert_record(record) }
end

#create!(attributes = {}) ⇒ Object



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

def create!(attributes = {})
  create_record(attributes) { |record| insert_record(record, true) }
end

#reset_column_informationObject



16
17
18
# File 'lib/active_record/associations/has_and_belongs_to_many_association.rb', line 16

def reset_column_information
  @reflection.reset_column_information
end