Class: BhmAdmin::Generators::ResourceGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- BhmAdmin::Generators::ResourceGenerator
- Includes:
- Rails::Generators::ResourceHelpers
- Defined in:
- lib/generators/bhm_admin/resource/resource_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
6 7 8 |
# File 'lib/generators/bhm_admin/resource/resource_generator.rb', line 6 def self.source_root @_bar_source_root ||= File.("templates", File.dirname(__FILE__)) end |
Instance Method Details
#create_controller_files ⇒ Object
12 13 14 15 |
# File 'lib/generators/bhm_admin/resource/resource_generator.rb', line 12 def create_controller_files actual_class_path = controller_class_path + ["#{controller_file_path}_controller.rb"] template 'controller.rb', File.join('app/controllers/admin', *actual_class_path) end |
#create_template_files ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/generators/bhm_admin/resource/resource_generator.rb', line 17 def create_template_files base_path = File.join("app/views/admin", *(controller_class_path + [controller_file_path])) empty_directory base_path %w(new edit index show _form).each do |view| sub_path = "#{view}.html.haml" template sub_path, File.join(base_path, sub_path) end end |