Sha256: 69a9895841f39e45615dcc00af78839967aef8db0fabbe3ca485040ea51fd87a

Contents?: true

Size: 787 Bytes

Versions: 14

Compression:

Stored size: 787 Bytes

Contents

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

14 entries across 14 versions & 1 rubygems

Version Path
rom-sql-3.1.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.0.1 lib/rom/sql/associations/one_to_many.rb
rom-sql-3.0.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.5.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.4.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.3.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.2.1 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.2.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.1.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.0.0 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.0.0.rc1 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.0.0.beta3 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.0.0.beta2 lib/rom/sql/associations/one_to_many.rb
rom-sql-2.0.0.beta1 lib/rom/sql/associations/one_to_many.rb