Class: AdminResourceGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Rails::Generators::ResourceHelpers
Defined in:
lib/generators/admin_resource_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_controller_fileObject



5
6
7
# File 'lib/generators/admin_resource_generator.rb', line 5

def create_controller_file
  template "admin_resource/controller.rb", File.join("app/controllers/admin/", "#{controller_file_name}_controller.rb")
end

#create_decorator_fileObject



9
10
11
# File 'lib/generators/admin_resource_generator.rb', line 9

def create_decorator_file
  template "admin_resource/decorator.rb", File.join("app/decorators/", "#{singular_name}_decorator.rb")
end

#create_view_fileObject



13
14
15
# File 'lib/generators/admin_resource_generator.rb', line 13

def create_view_file
  copy_file "admin_resource/views/_form.html.erb", "app/views/admin/#{plural_name}/_form.html.erb"
end