Class: ROM::SQL::Associations::OneToMany
- Inherits:
-
Associations::OneToMany
- Object
- Associations::OneToMany
- ROM::SQL::Associations::OneToMany
- Includes:
- SelfRef
- Defined in:
- lib/rom/sql/associations/one_to_many.rb
Direct Known Subclasses
Instance Method Summary collapse
- #call(target: self.target) ⇒ Object
- #join(type, source = self.source, target = self.target) ⇒ Object
- #join_keys ⇒ Object included from SelfRef
- #source_attr ⇒ Object included from SelfRef
- #target_attr ⇒ Object included from SelfRef
Instance Method Details
#call(target: self.target) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rom/sql/associations/one_to_many.rb', line 15 def call(target: self.target) schema = target.schema.qualified relation = target.join(source_table, join_keys) if view apply_view(schema, relation) else schema.(relation) end end |
#join(type, source = self.source, target = self.target) ⇒ Object
27 28 29 |
# File 'lib/rom/sql/associations/one_to_many.rb', line 27 def join(type, source = self.source, target = self.target) source.__send__(type, target.name.dataset, join_keys).qualified end |