Class: ROM::SQL::Associations::OneToMany

Inherits:
Associations::OneToMany
  • Object
show all
Includes:
Core, SelfRef
Defined in:
lib/rom/sql/associations/one_to_many.rb

Direct Known Subclasses

OneToOne

Instance Method Summary collapse

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

#join_keysObject Originally defined in module SelfRef

#preload(target, loaded) ⇒ Object Originally defined in module Core

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.

#source_attrObject Originally defined in module SelfRef

#target_attrObject Originally defined in module SelfRef

#wrappedObject Originally defined in module Core

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.