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