Class: ActiveEntity::Associations::Embeds::SingularAssociation
- Inherits:
-
Association
- Object
- Association
- ActiveEntity::Associations::Embeds::SingularAssociation
- Defined in:
- lib/active_entity/associations/embeds/singular_association.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Association
Instance Method Summary collapse
- #build(attributes = {}, &block) ⇒ Object
-
#reader ⇒ Object
Implements the reader method, e.g.
-
#writer(record) ⇒ Object
Implements the writer method, e.g.
Methods inherited from Association
#extensions, #initialize, #initialize_attributes, #inversed_from, #klass, #loaded?, #marshal_dump, #marshal_load, #remove_inverse_instance, #set_inverse_instance
Constructor Details
This class inherits a constructor from ActiveEntity::Associations::Embeds::Association
Instance Method Details
#build(attributes = {}, &block) ⇒ Object
17 18 19 20 21 |
# File 'lib/active_entity/associations/embeds/singular_association.rb', line 17 def build(attributes = {}, &block) record = build_record(attributes, &block) set_new_record(record) record end |
#reader ⇒ Object
Implements the reader method, e.g. foo.bar for Foo.has_one :bar
8 9 10 |
# File 'lib/active_entity/associations/embeds/singular_association.rb', line 8 def reader target end |
#writer(record) ⇒ Object
Implements the writer method, e.g. foo.bar= for Foo.belongs_to :bar
13 14 15 |
# File 'lib/active_entity/associations/embeds/singular_association.rb', line 13 def writer(record) replace(record) end |