Class: ActiveRecord::ConnectionAdapters::PostgreSQLColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/active_record/connection_adapters/postgresql/column.rb

Overview

PostgreSQL-specific extensions to column definitions in a table.

Constant Summary

Constants inherited from Column

Column::FALSE_VALUES, Column::TRUE_VALUES

Instance Attribute Summary collapse

Attributes inherited from Column

#cast_type, #default, #default_function, #name, #null, #sql_type

Instance Method Summary collapse

Methods inherited from Column

#==, #has_default?, #hash, #human_name, #with_type

Constructor Details

#initialize(name, default, cast_type, sql_type = nil, null = true, default_function = nil) ⇒ PostgreSQLColumn

Returns a new instance of PostgreSQLColumn.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/active_record/connection_adapters/postgresql/column.rb', line 7

def initialize(name, default, cast_type, sql_type = nil, null = true, default_function = nil)
  if sql_type =~ /\[\]$/
    @array = true
    super(name, default, cast_type, sql_type[0..sql_type.length - 3], null)
  else
    @array = false
    super(name, default, cast_type, sql_type, null)
  end

  @default_function = default_function
end

Instance Attribute Details

#arrayObject

:nodoc:



5
6
7
# File 'lib/active_record/connection_adapters/postgresql/column.rb', line 5

def array
  @array
end