Class: GdatastoreMapper::Associations::HasMany
- Inherits:
-
Object
- Object
- GdatastoreMapper::Associations::HasMany
- Defined in:
- lib/gdatastore_mapper/associations/has_many.rb
Instance Attribute Summary collapse
-
#belonging ⇒ Object
Returns the value of attribute belonging.
-
#owner ⇒ Object
Returns the value of attribute owner.
Instance Method Summary collapse
- #belonging_id ⇒ Object
- #belonging_klass ⇒ Object
-
#initialize(owner, belonging) ⇒ HasMany
constructor
A new instance of HasMany.
- #owner_attributes ⇒ Object
Constructor Details
#initialize(owner, belonging) ⇒ HasMany
Returns a new instance of HasMany.
7 8 9 10 |
# File 'lib/gdatastore_mapper/associations/has_many.rb', line 7 def initialize(owner, belonging) @owner = owner @belonging = belonging end |
Instance Attribute Details
#belonging ⇒ Object
Returns the value of attribute belonging.
5 6 7 |
# File 'lib/gdatastore_mapper/associations/has_many.rb', line 5 def belonging @belonging end |
#owner ⇒ Object
Returns the value of attribute owner.
5 6 7 |
# File 'lib/gdatastore_mapper/associations/has_many.rb', line 5 def owner @owner end |
Instance Method Details
#belonging_id ⇒ Object
22 23 24 |
# File 'lib/gdatastore_mapper/associations/has_many.rb', line 22 def belonging_id @belonging.to_s + '_id' end |
#belonging_klass ⇒ Object
12 13 14 |
# File 'lib/gdatastore_mapper/associations/has_many.rb', line 12 def belonging_klass @belonging.to_s.classify.constantize end |
#owner_attributes ⇒ Object
16 17 18 19 20 |
# File 'lib/gdatastore_mapper/associations/has_many.rb', line 16 def owner_attributes { (@owner.class.to_s.underscore + '_id') => @owner.id } end |