Class: DatastaxRails::Associations::HasManyAssociation

Inherits:
CollectionAssociation show all
Defined in:
lib/datastax_rails/associations/has_many_association.rb

Overview

This is the proxy that handles a has many association.

If the association has a :through option further specialization is provided by its child HasManyThroughAssociation.

Instance Attribute Summary

Attributes inherited from CollectionAssociation

#proxy

Attributes inherited from Association

#loaded, #owner, #reflection, #target

Instance Method Summary collapse

Methods inherited from CollectionAssociation

#add_to_target, #any?, #build, #concat, #create, #create!, #delete, #delete_all, #destroy, #destroy_all, #empty?, #ids_reader, #ids_writer, #initialize, #load_target, #many?, #reader, #replace, #reset, #size, #uniq, #writer

Methods inherited from Association

#aliased_column_family, #association_scope, #initialize, #klass, #load_target, #loaded!, #reload, #reset, #reset_scope, #scoped, #set_inverse_instance, #stale_target?, #target_scope

Constructor Details

This class inherits a constructor from DatastaxRails::Associations::CollectionAssociation

Instance Method Details

#insert_record(record, validate = true, raise = false) ⇒ Object

:nodoc:


8
9
10
11
12
13
14
15
16
17
# File 'lib/datastax_rails/associations/has_many_association.rb', line 8

def insert_record(record, validate = true, raise = false)
  set_owner_attributes(record)
  set_inverse_instance(record)

  if raise
    record.save!(validate: validate)
  else
    record.save(validate: validate)
  end
end