Method: EngineRoom::ModelsController#overview2

Defined in:
app/controllers/engine_room/models_controller.rb

#overview2Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/engine_room/models_controller.rb', line 29

def overview2
  @models = []
  missing_models = []
  missing_tables = []
  Section.all.each do |section|
    begin
      model = get_model(section.model_name)
      if model.table_exists?
        @models << model
      else
        missing_tables << section.model_name
      end
    rescue NameError
      missing_models << section.model_name
    end
  end
  
  flash_alert = ""
  flash_alert += "Table(s) not found: '#{missing_tables.uniq.join("', '")}'. " unless missing_tables.empty?
  flash_alert += "Model(s) not found: '#{missing_models.uniq.join("', '")}'." unless missing_models.empty?
  flash[:alert] = flash_alert unless flash_alert.empty?
end