Module: Torque::PostgreSQL::Adapter::TableDefinition

Includes:
ColumnMethods
Defined in:
lib/torque/postgresql/adapter/schema_definitions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ColumnMethods

#enum, #enum_set, #interval

Instance Attribute Details

#inheritsObject (readonly)

Returns the value of attribute inherits.



35
36
37
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 35

def inherits
  @inherits
end

Instance Method Details

#inherited_id?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 52

def inherited_id?
  @inherited_id
end

#initialize(name, *_, **options) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 37

def initialize(name, *_, **options)
  old_args = []
  old_args << options.delete(:temporary) || false
  old_args << options.delete(:options)
  old_args << options.delete(:as)
  comment = options.delete(:comment)

  super(name, *old_args, comment: comment)

  if options.key?(:inherits)
    @inherits = Array[options.delete(:inherits)].flatten.compact
    @inherited_id = !(options.key?(:primary_key) || options.key?(:id))
  end
end