Class: Disco::Generators::ScaffoldGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Disco::Generators::ScaffoldGenerator
- Includes:
- Domain, ProcessorName
- Defined in:
- lib/generators/disco/scaffold/scaffold_generator.rb
Constant Summary collapse
- ACTIONS =
%w(create update delete)
Instance Method Summary collapse
Methods included from Domain
Methods included from ProcessorName
Instance Method Details
#add_routes ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/disco/scaffold/scaffold_generator.rb', line 24 def add_routes routing_code = '' class_path.each_with_index do |namespace, index| add_line_with_indent routing_code, (index + 1), "namespace :#{namespace} do" end add_line_with_indent routing_code, (class_path.length + 1), "resources :#{plural_name}" class_path.each_with_index do |_, index| add_line_with_indent routing_code, (class_path.length - index), 'end' end route routing_code[2..-1] end |