Class: CrazyTrain::Table

Inherits:
Object
  • Object
show all
Defined in:
app/models/crazy_train/table.rb

Constant Summary collapse

SYSTEM_TABLES =
%w[ar_internal_metadata schema_migrations].freeze

Class Method Summary collapse

Class Method Details

.classesObject



10
11
12
# File 'app/models/crazy_train/table.rb', line 10

def classes
  names.map { |name| name.classify.constantize }
end

.klass(name) ⇒ Object



14
15
16
# File 'app/models/crazy_train/table.rb', line 14

def klass(name)
  name.classify.constantize
end

.namesObject



6
7
8
# File 'app/models/crazy_train/table.rb', line 6

def names
  ActiveRecord::Base.connection.tables - SYSTEM_TABLES
end