Class: Koi::AdminRouteGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Koi::AdminRouteGenerator
- Includes:
- Rails::Generators::ResourceHelpers
- Defined in:
- lib/generators/koi/admin_route/admin_route_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_navigation ⇒ Object
28 29 30 31 32 33 |
# File 'lib/generators/koi/admin_route/admin_route_generator.rb', line 28 def insert_into_file("config/initializers/koi.rb", " \"#{[*regular_class_path.map(&:humanize), human_name.pluralize].join(' ')}\" => \"/admin#{route_url}\",\n", after: "Koi::Menu.modules = {\n") end |
#add_route ⇒ Object
18 19 20 |
# File 'lib/generators/koi/admin_route/admin_route_generator.rb', line 18 def add_route route "resources :#{file_name.pluralize}", namespace: regular_class_path end |
#create_navigation ⇒ Object
22 23 24 25 26 |
# File 'lib/generators/koi/admin_route/admin_route_generator.rb', line 22 def return if Pathname.new(destination_root).join("config/initializers/koi.rb").exist? template("initializer.rb", "config/initializers/koi.rb") end |
#create_routes ⇒ Object
12 13 14 15 16 |
# File 'lib/generators/koi/admin_route/admin_route_generator.rb', line 12 def create_routes return if Pathname.new(destination_root).join("config/routes/admin.rb").exist? template("routes.rb", "config/routes/admin.rb") end |