Class: Adhoq::CurrentTablesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/adhoq/current_tables_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

before_action

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/adhoq/current_tables_controller.rb', line 5

def index
  hidden_model_names = Array(Adhoq.config.hidden_model_names)
  hidden_model_names << 'ActiveRecord::SchemaMigration'
  hidden_model_names << 'ApplicationRecord'

  @ar_classes = ActiveRecord::Base.descendants.
    reject {|klass| klass.abstract_class? || hidden_model_names.include?(klass.name) || klass.name.nil? }.
    sort_by(&:name)

  render layout: false
end