Class: ROM::LDAP::Associations::OneToMany

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

Direct Known Subclasses

OneToOne

Instance Method Summary collapse

Methods included from SelfRef

included, #join_keys, #source_attr, #target_attr

Methods included from Core

#preload

Instance Method Details

#call(target: self.target) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rom/ldap/associations/one_to_many.rb', line 17

def call(target: self.target)
  schema = target.schema
  target_fks = target.list(foreign_key).uniq
  relation = source.where(source.primary_key => target_fks)

  if view
    apply_view(schema, relation)
  else
    schema.call(relation)
  end
end