ActiveRecord::ConnectionAdapters::Column


Files

Parent

Description

An abstract definition of a column in a table.

Methods

Classes and Modules

Constants

TRUE_VALUES

[true, 1, '1', 't', 'T', 'true', 'TRUE'].to_set

Attributes

[R] [R] [R] [R] [R] [RW] [R] [R] [R]

Public Class methods

binary_to_string (value)

Used to convert from BLOBs to Strings

new (name, default, sql_type = nil, null = true)

Instantiates a new column in the table.

name is the column‘s name, such as supplier_id in supplier_id int(11). default is the type-casted default value, such as new in sales_stage varchar(20) default ‘new. sql_type is only used to extract the column‘s length, if necessary. For example +60+ in company_name varchar(60). null determines if this column allows NULL values.

string_to_binary (value)

Used to convert from Strings to BLOBs

string_to_date (string)

string_to_dummy_time (string)

string_to_time (string)

value_to_boolean (value)

convert something to a boolean

value_to_decimal (value)

convert something to a BigDecimal

Protected Class methods

fallback_string_to_date (string)

fallback_string_to_time (string)

fast_string_to_date (string)

fast_string_to_time (string)

Doesn‘t handle time zones.

microseconds (time)

‘0.123456’ -> 123456 ‘1.123456’ -> 123456

new_date (year, mon, mday)

new_time (year, mon, mday, hour, min, sec, microsec)

Public Instance methods

extract_default (default)

has_default? ()

human_name ()

Returns the human name of the column name.

Examples
 Column.new('sales_stage', ...).human_name # => 'Sales stage'

klass ()

Returns the Ruby class that corresponds to the abstract data type.

number? ()

text? ()

type_cast (value)

Casts value (which is a String) to an appropriate instance.

type_cast_code (var_name)