Class: Godmin::ResourceGenerator
- Inherits:
-
Generators::NamedBase
- Object
- Rails::Generators::Base
- Generators::Base
- Generators::NamedBase
- Godmin::ResourceGenerator
- Defined in:
- lib/generators/godmin/resource/resource_generator.rb
Instance Method Summary collapse
Methods inherited from Generators::Base
Instance Method Details
#add_navigation ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/generators/godmin/resource/resource_generator.rb', line 10 def append_to_file File.join("app/views", namespaced_path, "shared/_navigation.html.erb") do <<-END.strip_heredoc <%= navbar_item #{class_name} %> END end end |
#add_route ⇒ Object
6 7 8 |
# File 'lib/generators/godmin/resource/resource_generator.rb', line 6 def add_route route "resources :#{file_name.pluralize}" end |
#create_controller ⇒ Object
18 19 20 |
# File 'lib/generators/godmin/resource/resource_generator.rb', line 18 def create_controller template "resource_controller.rb", File.join("app/controllers", class_path, "#{file_name.pluralize}_controller.rb") end |
#create_service ⇒ Object
22 23 24 |
# File 'lib/generators/godmin/resource/resource_generator.rb', line 22 def create_service template "resource_service.rb", File.join("app/services", class_path, "#{file_name}_service.rb") end |