Module: ROM::Types::Methods

Defined in:
lib/rom/types.rb

Overview

Type extensions

API:

  • public

Instance Method Summary collapse

Instance Method Details

#ForeignKey(relation, type = Types::Integer) ⇒ Dry::Types::Nominal

Shortcut for defining a foreign key attribute type

Parameters:

  • The name of the target relation

  • (defaults to: Types::Integer)

    The type of an attribute

Returns:

API:

  • public



32
33
34
# File 'lib/rom/types.rb', line 32

def ForeignKey(relation, type = Types::Integer)
  type.meta(foreign_key: true, target: relation)
end