instance method
columns
Ruby on Rails edge
Signature
columns(table_name)
Returns an array of Column objects for the given table, or a Hash of them keyed by table name when given an Array of tables.
Parameters
-
table_namereq
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 113
def columns(table_name)
result = fetch_column_definitions(Array(table_name).map(&:to_s)).to_h do |table, definitions|
[table, definitions.map { |field| new_column_from_field(table, field, definitions) }]
end
table_name.is_a?(Array) ? result : result[table_name.to_s]
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb line 113
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::SchemaStatements