Sha256: 54787731e15433c9fef2ac0219100651159925510835d43d66f184f3834eadba

Contents?: true

Size: 818 Bytes

Versions: 12

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

require 'rom/associations/one_to_many'
require 'rom/sql/associations/core'
require 'rom/sql/associations/self_ref'

module ROM
  module SQL
    module Associations
      class OneToMany < ROM::Associations::OneToMany
        include Associations::Core
        include Associations::SelfRef

        # @api public
        def call(target: self.target)
          schema = target.schema.qualified
          relation = target.join(source_table, join_keys)

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

        # @api public
        def join(type, source = self.source, target = self.target)
          source.__send__(type, target.name.dataset, join_keys).qualified
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rom-sql-3.6.4 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.6.3 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.6.2 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.6.1 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.6.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.5.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.4.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.3.3 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.3.2 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.3.1 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.3.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.2.0 lib/rom/sql/associations/one_to_many.rb