Class: ActiveRecord::ConnectionAdapters::ColumnDefinition

Inherits:
Struct
  • Object
show all
Defined in:
lib/active_record/connection_adapters/abstract/schema_definitions.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#baseObject

Returns the value of attribute base

Returns:

  • (Object)

    the current value of base



167
168
169
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 167

def base
  @base
end

#defaultObject

Returns the value of attribute default

Returns:

  • (Object)

    the current value of default



167
168
169
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 167

def default
  @default
end

#limitObject

Returns the value of attribute limit

Returns:

  • (Object)

    the current value of limit



167
168
169
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 167

def limit
  @limit
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



167
168
169
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 167

def name
  @name
end

#nullObject

Returns the value of attribute null

Returns:

  • (Object)

    the current value of null



167
168
169
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 167

def null
  @null
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



167
168
169
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 167

def type
  @type
end

Instance Method Details

#to_sqlObject Also known as: to_s



168
169
170
171
172
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 168

def to_sql
  column_sql = "#{base.quote_column_name(name)} #{type_to_sql(type.to_sym, limit)}"
  add_column_options!(column_sql, :null => null, :default => default)
  column_sql
end