Class: NinjaModel::Associations::BelongsToAssociation
- Inherits:
-
SingularAssociation
- Object
- Association
- SingularAssociation
- NinjaModel::Associations::BelongsToAssociation
- Defined in:
- lib/ninja_model/associations/belongs_to_association.rb
Instance Attribute Summary
Attributes inherited from Association
Instance Method Summary collapse
Methods inherited from SingularAssociation
#build, #create, #create!, #reader, #writer
Methods inherited from Association
#association_scope, #initialize, #klass, #load_target, #loaded!, #loaded?, #reload, #reset, #reset_scope, #scoped, #set_inverse_instance, #stale_target?, #target_scope
Constructor Details
This class inherits a constructor from NinjaModel::Associations::Association
Instance Method Details
#replace(record) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/ninja_model/associations/belongs_to_association.rb', line 5 def replace(record) raise_on_type_mismatch(record) if record replace_keys(record) @updated = true if record self.target = record end |
#updated? ⇒ Boolean
15 16 17 |
# File 'lib/ninja_model/associations/belongs_to_association.rb', line 15 def updated? @updated end |