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, #delete, #delete_all, #destroy_all, #empty?, #find, #first, #include?, #initialize, #last, #length, #replace, #reset, #size, #sum, #to_ary, #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?, #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

#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