aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb
blob: 6a5d62803c0ae75c9386d9e21cecf52c3966262b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
module Rails
  module Generators
    class ResourceRouteGenerator < NamedBase
      def add_resource_route
        return if options[:actions].present?
        route_config =  regular_class_path.collect{ |namespace| "namespace :#{namespace} do " }.join(" ")
        route_config << "resources :#{file_name.pluralize}"
        route_config << " end" * regular_class_path.size
        route route_config
      end
    end
  end
end