Class: AlterAdmin::Generators::ResourceGenerator
- Inherits:
-
Base
- Object
- Rails::Generators::NamedBase
- Base
- AlterAdmin::Generators::ResourceGenerator
- Defined in:
- lib/generators/alter_admin/resource/resource_generator.rb
Instance Method Summary collapse
- #add_model_admin_setting ⇒ Object
- #add_route ⇒ Object
- #add_views ⇒ Object
- #create_controller ⇒ Object
Methods inherited from Base
Instance Method Details
#add_model_admin_setting ⇒ Object
25 26 27 |
# File 'lib/generators/alter_admin/resource/resource_generator.rb', line 25 def add_model_admin_setting template "t_model_setting.rb", File.join('app/admin', "#{file_name}_admin_setting.rb") end |
#add_route ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/generators/alter_admin/resource/resource_generator.rb', line 11 def add_route route <<-ROUTE namespace :admin do resources :#{plural_name} end ROUTE end |
#add_views ⇒ Object
19 20 21 22 23 |
# File 'lib/generators/alter_admin/resource/resource_generator.rb', line 19 def add_views %w{index edit new _form show}.each do |view| template "views/#{view}.html.slim", File.join('app/views/admin', "#{file_name.pluralize}/#{view}.html.slim") end end |
#create_controller ⇒ Object
7 8 9 |
# File 'lib/generators/alter_admin/resource/resource_generator.rb', line 7 def create_controller template "controller.rb", File.join('app/controllers/admin', "#{file_name.pluralize}_controller.rb") end |