class method
self.new
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v3.0.20Signature
self.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.
Parameters
-
namereq -
defaultreq -
sql_typeopt = nil -
nullopt = true
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 26
def initialize(name, default, sql_type = nil, null = true)
@name, @sql_type, @null = name, sql_type, null
@limit, @precision, @scale = extract_limit(sql_type), extract_precision(sql_type), extract_scale(sql_type)
@type = simplified_type(sql_type)
@default = extract_default(default)
@primary = nil
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb line 26
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::Column