Class: Madmin::Generators::InstallGenerator

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

Instance Method Summary collapse

Methods included from Madmin::GeneratorHelpers

#call_generator

Instance Method Details

#generate_resourcesObject



9
10
11
12
13
# File 'lib/generators/madmin/install/install_generator.rb', line 9

def generate_resources
  resources.each do |model|
    call_generator "madmin:resource", model.to_s
  end
end

#install_routeObject



15
16
17
18
19
20
# File 'lib/generators/madmin/install/install_generator.rb', line 15

def install_route
  inject_into_file(
    Rails.root.join("config/routes.rb"),
    after: "Rails.application.routes.draw do\n"
  ) { "  namespace :madmin do\n  end\n  mount Madmin::Engine => \"/madmin\"\n" }
end