Class: ROM::Associations::OneToMany
- Defined in:
- core/lib/rom/associations/one_to_many.rb
Overview
Abstract one-to-many association
Direct Known Subclasses
Instance Attribute Summary collapse
- #__memoized__ ⇒ Object included from Memoizable readonly private
Instance Method Summary collapse
-
#associate(child, parent) ⇒ Hash
private
Associate child tuple with a parent.
-
#call ⇒ Object
abstract
Adapters must implement this method.
-
#foreign_key ⇒ Symbol
Return configured or inferred FK name.
Instance Attribute Details
#__memoized__ ⇒ Object (readonly) Originally defined in module Memoizable
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Instance Method Details
#associate(child, parent) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Associate child tuple with a parent
37 38 39 40 |
# File 'core/lib/rom/associations/one_to_many.rb', line 37 def associate(child, parent) pk, fk = join_key_map child.merge(fk => parent.fetch(pk)) end |
#call ⇒ Object
This method is abstract.
Adapters must implement this method
16 17 18 |
# File 'core/lib/rom/associations/one_to_many.rb', line 16 def call(*) raise NotImplementedError end |
#foreign_key ⇒ Symbol
Return configured or inferred FK name
25 26 27 |
# File 'core/lib/rom/associations/one_to_many.rb', line 25 def foreign_key definition.foreign_key || target.foreign_key(source.name) end |