Class: ActiveRecord::ConnectionAdapters::MysqlColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/connection_adapters/mysql_adapter.rb

Overview

:nodoc:

Constant Summary collapse

AUTO_INCREMENT =
"auto_increment"

Instance Method Summary collapse

Constructor Details

#initialize(name, default, sql_type = nil, null = true, extra = nil) ⇒ MysqlColumn

Returns a new instance of MysqlColumn.



12
13
14
15
16
# File 'lib/connection_adapters/mysql_adapter.rb', line 12

def initialize(name, default, sql_type = nil, null = true, extra = nil)
	if !(default.nil? || default.blank?) then @default_specified = true end
  base_initialize(name, default, sql_type, null)
  @extra = extra
end

Instance Method Details

#base_initializeObject

Capture the value of the “EXTRA” column in the column metadata table. This can be used to generate validations



11
# File 'lib/connection_adapters/mysql_adapter.rb', line 11

alias :base_initialize :initialize

#is_nullable?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/connection_adapters/mysql_adapter.rb', line 18

def is_nullable?
		@null || @default_specified	|| @extra == AUTO_INCREMENT
end