Sha256: 16a7263c9c6980fae806d68fea4ed609d35dcbe1b8031e2400fa15497672ea27
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
module ROM module Plugins module Relation module SQL module AutoWrap # @api private def self.included(klass) super klass.class_eval do include(InstanceInterface) extend(ClassInterface) end end module ClassInterface def inherited(klass) super klass.auto_curry :for_wrap end end module InstanceInterface # Default methods for fetching wrapped relation # # This method is used by default by `wrap` and `wrap_parents` # # @return [SQL::Relation] # # @api private 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 end end end end end end ROM.plugins do adapter :sql do register :auto_wrap, ROM::Plugins::Relation::SQL::AutoWrap, type: :relation end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rom-sql-0.9.1 | lib/rom/plugins/relation/sql/auto_wrap.rb |
rom-sql-0.9.0 | lib/rom/plugins/relation/sql/auto_wrap.rb |
rom-sql-0.8.0 | lib/rom/plugins/relation/sql/auto_wrap.rb |