Module: ROM::Plugins::Relation::SQL::AutoWrap::InstanceInterface

Defined in:
lib/rom/plugins/relation/sql/auto_wrap.rb

Instance Method Summary collapse

Instance Method Details

#for_wrap(keys, name) ⇒ SQL::Relation

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.

Default methods for fetching wrapped relation

This method is used by default by ‘wrap` and `wrap_parents`

Returns:



30
31
32
33
34
35
36
37
# File 'lib/rom/plugins/relation/sql/auto_wrap.rb', line 30

def for_wrap(keys, name)
  other = __registry__[name]
  other_dataset = other.name.dataset

  inner_join(other_dataset, keys)
    .select(*qualified.header.columns)
    .select_append(*other.prefix(other_dataset).qualified.header)
end