Class: ActiveRecord::ConnectionAdapters::MysqlColumn
- Defined in:
- lib/connection_adapters/mysql_adapter.rb
Overview
:nodoc:
Constant Summary collapse
- AUTO_INCREMENT =
"auto_increment"
Instance Method Summary collapse
-
#base_initialize ⇒ Object
Capture the value of the “EXTRA” column in the column metadata table.
-
#initialize(name, default, sql_type = nil, null = true, extra = nil) ⇒ MysqlColumn
constructor
A new instance of MysqlColumn.
- #is_nullable? ⇒ Boolean
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_initialize ⇒ Object
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
18 19 20 |
# File 'lib/connection_adapters/mysql_adapter.rb', line 18 def is_nullable? @null || @default_specified || @extra == AUTO_INCREMENT end |