class TableDefinition
Ruby on Rails 3.2.22.5
Since v2.2.3Represents the schema of an SQL table in an abstract way. This class provides methods for manipulating the schema representation.
Inside migration files, the t object in create_table is actually of this type:
class SomeMigration < ActiveRecord::Migration
def up
create_table :foo do |t|
puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition"
end
end
def down
...
end
end
The table definitions The Columns are stored as a ColumnDefinition in the columns attribute.
Inherits from
Attributes
Methods (defined here)
- # []
- # belongs_to
- # column
- # primary_key
- # references
- # timestamps
- # to_sql
- # xml
- self. new
Private methods
(2)
Implementation detail — not part of the public API.
Used by
Subclasses (1)
Methods (inherited)
From Object (18)
- # acts_like?
- # blank?
- # create_fixtures
- # duplicable?
- # html_safe?
- # in?
- # instance_variable_names
- # options
- # presence
- # present?
- # test_homepage
- # to_json
- # to_param
- # to_query
- # try
- # unescape
- # with_options
- self. table_name_prefix