Class: ActiveFedora::Associations::BelongsToAssociation
- Inherits:
-
SingularAssociation
- Object
- Association
- SingularAssociation
- ActiveFedora::Associations::BelongsToAssociation
- Defined in:
- lib/active_fedora/associations/belongs_to_association.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Association
#inversed, #owner, #reflection, #target
Instance Method Summary collapse
Methods inherited from SingularAssociation
#build, #create, #create!, #reader, #writer
Methods inherited from Association
#association_scope, #initialize, #initialize_attributes, #load_target, #loaded!, #loaded?, #reload, #scope, #set_inverse_instance, #stale_target?, #target_scope
Constructor Details
This class inherits a constructor from ActiveFedora::Associations::Association
Instance Method Details
#replace(record) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/active_fedora/associations/belongs_to_association.rb', line 5 def replace(record) if record raise_on_type_mismatch(record) run_type_validator(record) # update_counters(record) replace_keys(record) set_inverse_instance(record) @updated = true else # decrement_counters remove_keys end self.target = record end |
#reset ⇒ Object
21 22 23 24 |
# File 'lib/active_fedora/associations/belongs_to_association.rb', line 21 def reset super @updated = false end |
#updated? ⇒ Boolean
26 27 28 |
# File 'lib/active_fedora/associations/belongs_to_association.rb', line 26 def updated? @updated end |