aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2015-04-18 04:52:13 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2015-06-11 16:54:11 -0300
commite8100fc4e306818d5b9a5d2bfd75dcf3f44553b4 (patch)
tree45f04f065eb8f6807c053b1ac40a00118beb312a /railties/lib/rails
parentc19035299a314380285addf6f269591dc648d5cf (diff)
downloadrails-e8100fc4e306818d5b9a5d2bfd75dcf3f44553b4.tar.gz
rails-e8100fc4e306818d5b9a5d2bfd75dcf3f44553b4.tar.bz2
rails-e8100fc4e306818d5b9a5d2bfd75dcf3f44553b4.zip
Api apps scaffold generates routes without new and edit actions
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb b/railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb
index c986f95e67..17d22768ed 100644
--- a/railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb
+++ b/railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb
@@ -1,6 +1,8 @@
module Rails
module Generators
class ResourceRouteGenerator < NamedBase # :nodoc:
+ class_option :api, type: :boolean,
+ desc: "Preconfigure smaller stack for API only apps"
# Properly nests namespaces passed into a generator
#
@@ -22,7 +24,9 @@ module Rails
end
# inserts the primary resource
- write("resources :#{file_name.pluralize}", route_length + 1)
+ resources = "resources :#{file_name.pluralize}"
+ resources << ", except: [:new, :edit]" if options.api?
+ write(resources, route_length + 1)
# ends blocks
regular_class_path.each_index do |index|