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
- #add_navigation ⇒ Object
- #add_route ⇒ Object
- #create_controller ⇒ Object
- #create_model ⇒ Object
- #create_service ⇒ Object
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 invoke "resource_route" end |
#create_controller ⇒ Object
24 25 26 |
# File 'lib/generators/godmin/resource/resource_generator.rb', line 24 def create_controller template "resource_controller.rb", File.join("app/controllers", class_path, "#{file_name.pluralize}_controller.rb") end |
#create_model ⇒ Object
18 19 20 21 22 |
# File 'lib/generators/godmin/resource/resource_generator.rb', line 18 def create_model if namespaced? template "resource_model.rb", File.join("app/models", class_path, "#{file_name}.rb") end end |
#create_service ⇒ Object
28 29 30 |
# File 'lib/generators/godmin/resource/resource_generator.rb', line 28 def create_service template "resource_service.rb", File.join("app/services", class_path, "#{file_name}_service.rb") end |