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

binary_to_string human_name klass new number? string_to_binary string_to_date string_to_dummy_time string_to_time text? type_cast type_cast_code value_to_boolean

### Attributes

default | [R] |
limit | [R] |
name | [R] |
null | [R] |
primary | [RW] |
sql_type | [R] |
type | [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, as in `supplier_id` int(11). `default` is the type-casted default value, such as `sales_stage varchar(20) default ‘new‘`. `sql_type` is only used to extract the column‘s length, if necessary. For example, `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

### Public Instance methods

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)

[Validate]