class WhoAmI::TableInfo
Attributes
table_name[R]
Public Class Methods
new(table_name)
click to toggle source
# File lib/who_am_i/table_info.rb, line 3 def initialize(table_name) @table_name = table_name end
Public Instance Methods
columns()
click to toggle source
# File lib/who_am_i/table_info.rb, line 9 def columns @columns ||= begin columns_hash = ActiveRecord::Base.connection.schema_cache.columns_hash(@table_name) columns_hash.values.map do |column| TableColumnInfo.new(table_name: @table_name, column: column) end end end
indices()
click to toggle source
# File lib/who_am_i/table_info.rb, line 21 def indices @indices ||= ActiveRecord::Base.connection.indexes(@table_name) end