instance method
columns_hash
Ruby on Rails 7.1.6
Since v3.2.22.5Signature
columns_hash(connection, table_name)
Get the columns for a table as a hash, key is the column name value is the column object.
Parameters
-
connectionreq -
table_namereq
Source
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 352
def columns_hash(connection, table_name)
@columns_hash.fetch(table_name) do
@columns_hash[deep_deduplicate(table_name)] = columns(connection, table_name).index_by(&:name).freeze
end
end
Defined in activerecord/lib/active_record/connection_adapters/schema_cache.rb line 352
· View on GitHub
· Improve this page
· Find usages on GitHub