class NestedScaffold::Generators::NestedScaffoldGenerator

Public Instance Methods

add_resource_route() click to toggle source

override

# File lib/generators/nested_scaffold_generator.rb, line 25
def add_resource_route
  return if options[:actions].present?
  route_config = "resources :#{plural_nested_parent_name} do\n" \
                 "  resources :#{file_name.pluralize}\n" \
                 "end\n"
  route route_config

  gsub_file 'config/routes.rb', / *resources :#{plural_nested_parent_name}\n/, ''
end