Class: SpicyValidation::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/spicy_validation/schema.rb

Class Method Summary collapse

Class Method Details

.columns(table_name:) ⇒ Object



12
13
14
# File 'lib/spicy_validation/schema.rb', line 12

def self.columns(table_name:)
  ActiveRecord::Base.connection.columns(table_name)
end

.indexes(table_name:) ⇒ Object



16
17
18
# File 'lib/spicy_validation/schema.rb', line 16

def self.indexes(table_name:)
  ActiveRecord::Base.connection.indexes(table_name)
end

.table_namesObject



5
6
7
8
9
10
# File 'lib/spicy_validation/schema.rb', line 5

def self.table_names
  abstract_tables = [ActiveRecord::SchemaMigration.table_name, ActiveRecord::InternalMetadata.table_name]
  ActiveRecord::Base
    .connection.tables
    .delete_if { |t| abstract_tables.include?(t) }
end