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
- #preload(target, loaded) ⇒ Object private
- #wrapped ⇒ Object private
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 |
#wrapped ⇒ 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.
19 20 21 22 23 24 |
# File 'lib/rom/sql/associations/core.rb', line 19 def wrapped new_target = view ? target.send(view) : target to_wrap = self.class.allocate to_wrap.send(:initialize, definition, .merge(target: new_target)) to_wrap.wrap end |