Class: Rails::Generators::ScaffoldGenerator
- Inherits:
-
ResourceGenerator
- Object
- ResourceGenerator
- Rails::Generators::ScaffoldGenerator
- Defined in:
- lib/generators/scaffold/scaffold_generator.rb
Overview
metagenerator
Instance Method Summary collapse
Instance Method Details
#add_resource_route ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/generators/scaffold/scaffold_generator.rb', line 22 def add_resource_route return if [:actions].present? route_config = class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ") if [:singleton] route_config << "resource :#{file_name}" else route_config << "resources :#{file_name.pluralize}" end route_config << " end" * class_path.size route route_config end |