Class: Generators::Avo::AllResourcesGenerator

Inherits:
BaseGenerator
  • Object
show all
Defined in:
lib/generators/avo/all_resources_generator.rb

Instance Method Summary collapse

Methods inherited from BaseGenerator

#initialize

Constructor Details

This class inherits a constructor from Generators::Avo::BaseGenerator

Instance Method Details

#taskObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/avo/all_resources_generator.rb', line 8

def task
  # Rails.application.eager_load!
  # get all models
  models = fetch_models
  models.delete("ApplicationRecord")

  models
    .each do |model|
      Rails::Generators.invoke "avo:resource", [model.underscore], {}
    rescue => e
      puts "Error: #{e.message}"
    end
end