class ROM::ConfigurationDSL::Relation

Setup DSL-specific relation extensions

@private

Public Class Methods

build_class(name, options = EMPTY_HASH) click to toggle source

Generate a relation subclass

This is used by Setup#relation DSL

@api private

# File lib/rom/configuration_dsl/relation.rb, line 17
def self.build_class(name, options = EMPTY_HASH)
  class_name = "ROM::Relation[#{Inflector.camelize(name)}]"
  adapter = options.fetch(:adapter)

  Dry::Core::ClassBuilder.new(name: class_name, parent: ROM::Relation[adapter]).call do |klass|
    klass.gateway(options.fetch(:gateway, :default))
    klass.schema(name) {}
  end
end