Module: ROM::SQL::Associations::Core Private

Included in:
ManyToMany, ManyToOne, OneToMany
Defined in:
lib/rom/sql/associations/core.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Core SQL association API

Instance Method Summary collapse

Instance Method Details

#preload(target, loaded) ⇒ Object

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.



9
10
11
12
13
14
15
16
# File 'lib/rom/sql/associations/core.rb', line 9

def preload(target, loaded)
  source_key, target_key = join_keys.flatten(1)

  target_pks = loaded.pluck(source_key.key)
  target_pks.uniq!

  target.where(target_key => target_pks)
end