Class: Syncano::ActiveRecord::Association::Base
- Inherits:
-
Object
- Object
- Syncano::ActiveRecord::Association::Base
- Defined in:
- lib/syncano/active_record/association/base.rb
Overview
Base class for all associations
Instance Method Summary collapse
-
#belongs_to? ⇒ FalseClass
Checks if association is belongs_to type.
-
#has_many? ⇒ FalseClass
Checks if association is has_many type.
-
#has_one? ⇒ FalseClass
Checks if association is has_one type.
-
#initialize(source_model, name) ⇒ Base
constructor
Constructor for association.
Constructor Details
#initialize(source_model, name) ⇒ Base
Constructor for association
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
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
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
26 27 28 |
# File 'lib/syncano/active_record/association/base.rb', line 26 def has_one? false end |