forked from rails-api/rails-api
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff7191c
commit cb30b62
Showing
2 changed files
with
33 additions
and
12 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
lib/generators/rails/bare_resource_route/bare_resource_route_generator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'rails/generators/rails/resource_route/resource_route_generator' | ||
|
||
module Rails | ||
module Generators | ||
class BareResourceRouteGenerator < ResourceRouteGenerator | ||
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 << ", except: :edit" | ||
route_config << " end" * regular_class_path.size | ||
route route_config | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters