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
21 22 23 |
# File 'lib/passive_record/associations/belongs_to.rb', line 21 def association @association end |
#child_model ⇒ Object
Returns the value of attribute child_model
21 22 23 |
# File 'lib/passive_record/associations/belongs_to.rb', line 21 def child_model @child_model end |
Instance Method Details
#lookup ⇒ Object
26 27 28 |
# File 'lib/passive_record/associations/belongs_to.rb', line 26 def lookup association.parent_class.find_by(parent_model_id) end |
#parent_model_id ⇒ Object
30 31 32 |
# File 'lib/passive_record/associations/belongs_to.rb', line 30 def parent_model_id @parent_model_id ||= nil end |
#parent_model_id=(id) ⇒ Object
34 35 36 |
# File 'lib/passive_record/associations/belongs_to.rb', line 34 def parent_model_id=(id) @parent_model_id = id end |
#singular? ⇒ Boolean
22 23 24 |
# File 'lib/passive_record/associations/belongs_to.rb', line 22 def singular? true end |