Class: Administrate::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Administrate::GeneratorHelpers
Defined in:
lib/generators/administrate/install/install_generator.rb

Instance Method Summary collapse

Methods included from Administrate::GeneratorHelpers

#call_generator

Instance Method Details

#create_dashboard_controllerObject



20
21
22
23
24
25
# File 'lib/generators/administrate/install/install_generator.rb', line 20

def create_dashboard_controller
  template(
    "application_controller.rb.erb",
    "app/controllers/#{namespace}/application_controller.rb",
  )
end

#run_dashboard_generatorsObject



27
28
29
30
31
32
# File 'lib/generators/administrate/install/install_generator.rb', line 27

def run_dashboard_generators
  singular_dashboard_resources.each do |resource|
    call_generator "administrate:dashboard", resource,
      "--namespace", namespace
  end
end

#run_routes_generatorObject



13
14
15
16
17
18
# File 'lib/generators/administrate/install/install_generator.rb', line 13

def run_routes_generator
  if dashboard_resources.none?
    call_generator("administrate:routes", "--namespace", namespace)
    load Rails.root.join("config/routes.rb")
  end
end