Class: PassiveRecord::Associations::BelongsToRelation
- Inherits:
-
Struct
- Object
- Struct
- PassiveRecord::Associations::BelongsToRelation
- Defined in:
- lib/passive_record/associations/belongs_to.rb
Instance Attribute Summary collapse
-
#association ⇒ Object
Returns the value of attribute association.
-
#child_model ⇒ Object
Returns the value of attribute child_model.
Instance Method Summary collapse
Instance Attribute Details
#association ⇒ Object
Returns the value of attribute association
13 14 15 |
# File 'lib/passive_record/associations/belongs_to.rb', line 13 def association @association end |
#child_model ⇒ Object
Returns the value of attribute child_model
13 14 15 |
# File 'lib/passive_record/associations/belongs_to.rb', line 13 def child_model @child_model end |
Instance Method Details
#lookup ⇒ Object
18 19 20 |
# File 'lib/passive_record/associations/belongs_to.rb', line 18 def lookup association.parent_class.find_by(parent_model_id) end |
#parent_model_id ⇒ Object
22 23 24 |
# File 'lib/passive_record/associations/belongs_to.rb', line 22 def parent_model_id @parent_model_id ||= nil end |
#parent_model_id=(id) ⇒ Object
26 27 28 |
# File 'lib/passive_record/associations/belongs_to.rb', line 26 def parent_model_id=(id) @parent_model_id = id end |
#singular? ⇒ Boolean
14 15 16 |
# File 'lib/passive_record/associations/belongs_to.rb', line 14 def singular? true end |