Class: Syncano::ActiveRecord::Association::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/syncano/active_record/association/base.rb

Overview

Base class for all associations

Direct Known Subclasses

BelongsTo, HasMany, HasOne

Instance Method Summary collapse

Constructor Details

#initialize(source_model, name) ⇒ Base

Constructor for association

Parameters:

  • source_model (Class)
  • name (Symbol)


12
13
14
15
16
# File 'lib/syncano/active_record/association/base.rb', line 12

def initialize(source_model, name)
  self.source_model = source_model
  self.associated_model = name.to_s.classify.constantize
  self.foreign_key = source_model.name.foreign_key
end

Instance Method Details

#belongs_to?FalseClass

Checks if association is belongs_to type

Returns:

  • (FalseClass)


20
21
22
# File 'lib/syncano/active_record/association/base.rb', line 20

def belongs_to?
  false
end

#has_many?FalseClass

Checks if association is has_many type

Returns:

  • (FalseClass)


32
33
34
# File 'lib/syncano/active_record/association/base.rb', line 32

def has_many?
  false
end

#has_one?FalseClass

Checks if association is has_one type

Returns:

  • (FalseClass)


26
27
28
# File 'lib/syncano/active_record/association/base.rb', line 26

def has_one?
  false
end