Class ActiveRecord::ConnectionAdapters::Column
In: lib/active_record/connection_adapters/abstract/schema_definitions.rb
Parent: Object

An abstract definition of a column in a table.

Methods

Classes and Modules

Module ActiveRecord::ConnectionAdapters::Column::Format

Constants

TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'].to_set
FALSE_VALUES = [false, 0, '0', 'f', 'F', 'false', 'FALSE'].to_set

Attributes

default  [R] 
limit  [R] 
name  [R] 
null  [R] 
precision  [R] 
primary  [RW] 
scale  [R] 
sql_type  [R] 
type  [R] 

Public Class methods

Used to convert from BLOBs to Strings

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 used to extract the column‘s length, if necessary. For example +60+ in company_name varchar(60). It will be mapped to one of the standard Rails SQL types in the type attribute. null determines if this column allows NULL values.

Used to convert from Strings to BLOBs

convert something to a boolean

convert something to a BigDecimal

Protected Class methods

Doesn‘t handle time zones.

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

Public Instance methods

Returns the human name of the column name.

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

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

Returns true if the column is either of type integer, float or decimal.

Returns true if the column is either of type string or text.

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

[Validate]