Class: Rails::Generators::ScaffoldGenerator

Inherits:
ResourceGenerator
  • Object
show all
Defined in:
lib/generators/scaffold/scaffold_generator.rb

Overview

metagenerator

Instance Method Summary collapse

Instance Method Details

#add_resource_routeObject



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 options[:actions].present?
  route_config =  class_path.collect{|namespace| "namespace :#{namespace} do " }.join(" ")
  if options[:singleton]
    route_config << "resource :#{file_name}"
  else
    route_config << "resources :#{file_name.pluralize}"
  end
  route_config << " end" * class_path.size
  route route_config
end