Class: Seedie::Associations::BaseAssociation

Inherits:
Object
  • Object
show all
Includes:
Reporters::Reportable
Defined in:
lib/seedie/associations/base_association.rb

Direct Known Subclasses

BelongsTo, HasAndBelongsToMany, HasMany, HasOne

Constant Summary collapse

DEFAULT_COUNT =
1
INDEX =
0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Reporters::Reportable

#add_observers, #report

Constructor Details

#initialize(record, model, association_config, reporters = []) ⇒ BaseAssociation

Returns a new instance of BaseAssociation.



13
14
15
16
17
18
19
20
# File 'lib/seedie/associations/base_association.rb', line 13

def initialize(record, model, association_config, reporters = [])
  @record = record
  @model = model
  @association_config = association_config
  @reporters = reporters

  add_observers(@reporters)
end

Instance Attribute Details

#association_configObject (readonly)

Returns the value of attribute association_config.



11
12
13
# File 'lib/seedie/associations/base_association.rb', line 11

def association_config
  @association_config
end

#modelObject (readonly)

Returns the value of attribute model.



11
12
13
# File 'lib/seedie/associations/base_association.rb', line 11

def model
  @model
end

#recordObject (readonly)

Returns the value of attribute record.



11
12
13
# File 'lib/seedie/associations/base_association.rb', line 11

def record
  @record
end

#reportersObject (readonly)

Returns the value of attribute reporters.



11
12
13
# File 'lib/seedie/associations/base_association.rb', line 11

def reporters
  @reporters
end

Instance Method Details

#generate_associationObject

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/seedie/associations/base_association.rb', line 26

def generate_association
  raise NotImplementedError
end

#generate_associationsObject

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/seedie/associations/base_association.rb', line 22

def generate_associations
  raise NotImplementedError
end