Class: Vorpal::Config::BelongsToConfig
- Inherits:
-
Object
- Object
- Vorpal::Config::BelongsToConfig
- Includes:
- LocalEndConfig, Util::HashInitialization
- Defined in:
- lib/vorpal/config/belongs_to_config.rb
Overview
Object association terminology:
-
All object associations are uni-directional
-
The end that holds the association is the ‘Owner’ and the end that is referred to is the ‘Associate’ or ‘Associates’
Relational association terminology:
-
Local end: has FK
-
Remote end: has no FK
Instance Attribute Summary collapse
-
#associated_classes ⇒ Object
readonly
Returns the value of attribute associated_classes.
-
#association_config ⇒ Object
Returns the value of attribute association_config.
-
#fk ⇒ Object
readonly
Returns the value of attribute fk.
-
#fk_type ⇒ Object
readonly
Returns the value of attribute fk_type.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owned ⇒ Object
readonly
Returns the value of attribute owned.
-
#unique_key_name ⇒ Object
readonly
Returns the value of attribute unique_key_name.
Instance Method Summary collapse
Methods included from LocalEndConfig
#associated_class_config, #fk_value, #set_foreign_key
Methods included from Util::HashInitialization
Instance Attribute Details
#associated_classes ⇒ Object (readonly)
Returns the value of attribute associated_classes.
19 20 21 |
# File 'lib/vorpal/config/belongs_to_config.rb', line 19 def associated_classes @associated_classes end |
#association_config ⇒ Object
Returns the value of attribute association_config.
20 21 22 |
# File 'lib/vorpal/config/belongs_to_config.rb', line 20 def association_config @association_config end |
#fk ⇒ Object (readonly)
Returns the value of attribute fk.
19 20 21 |
# File 'lib/vorpal/config/belongs_to_config.rb', line 19 def fk @fk end |
#fk_type ⇒ Object (readonly)
Returns the value of attribute fk_type.
19 20 21 |
# File 'lib/vorpal/config/belongs_to_config.rb', line 19 def fk_type @fk_type end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
19 20 21 |
# File 'lib/vorpal/config/belongs_to_config.rb', line 19 def name @name end |
#owned ⇒ Object (readonly)
Returns the value of attribute owned.
19 20 21 |
# File 'lib/vorpal/config/belongs_to_config.rb', line 19 def owned @owned end |
#unique_key_name ⇒ Object (readonly)
Returns the value of attribute unique_key_name.
19 20 21 |
# File 'lib/vorpal/config/belongs_to_config.rb', line 19 def unique_key_name @unique_key_name end |
Instance Method Details
#associate(owner, associate) ⇒ Object
26 27 28 |
# File 'lib/vorpal/config/belongs_to_config.rb', line 26 def associate(owner, associate) owner.send("#{name}=", associate) end |
#get_associated(owner) ⇒ Object
22 23 24 |
# File 'lib/vorpal/config/belongs_to_config.rb', line 22 def get_associated(owner) owner.send(name) end |
#pretty_name ⇒ Object
30 31 32 |
# File 'lib/vorpal/config/belongs_to_config.rb', line 30 def pretty_name "#{association_config.local_class_config.domain_class.name} belongs_to :#{name}" end |