Class: ActiveRecord::ConnectionAdapters::ColumnDefinition

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

Overview

Abstract representation of a column definition. Instances of this type are typically created by methods in TableDefinition, and added to the columns attribute of said TableDefinition object, in order to be used for generating a number of table creation or table changing SQL statements.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#as_json

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



79
80
81
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 79

def name
  @name
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



79
80
81
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 79

def options
  @options
end

#sql_typeObject

Returns the value of attribute sql_type

Returns:

  • (Object)

    the current value of sql_type



79
80
81
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 79

def sql_type
  @sql_type
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



79
80
81
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 79

def type
  @type
end

Instance Method Details

#aliased_types(name, fallback) ⇒ Object



109
110
111
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 109

def aliased_types(name, fallback)
  "timestamp" == name ? :datetime : fallback
end

#primary_key?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 93

def primary_key?
  options[:primary_key]
end