Skip to content
This repository
Browse code

Fix scaffold_resource generator so it respects the --pretend argument…

… when creating the routes file. Closes #6852 [fearoffish]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5790 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 29ec023adde3bf174f4f256d1ca34b68c7a1502a 1 parent ef1232c
risk danger olson authored December 26, 2006
2  railties/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Fix scaffold_resource generator so it respects the --pretend argument when creating the routes file.  Closes #6852 [fearoffish]
  4
+
3 5
 * Fix Webrick Daemon dispatching bug regarding a bad current working directory.  Closes #4899 [Rick Olson]
4 6
 
5 7
 * Make config.plugins affect the load path and the dependencies system.  Allows you to control plugin loading order, and keep disabled plugins off the load path. [James Adam]
6  railties/lib/rails_generator/commands.rb
@@ -342,8 +342,10 @@ def route_resources(*resources)
342 342
           sentinel = 'ActionController::Routing::Routes.draw do |map|'
343 343
 
344 344
           logger.route "map.resources #{resource_list}"
345  
-          gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
346  
-            "#{match}\n  map.resources #{resource_list}\n"
  345
+          unless options[:pretend]
  346
+            gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
  347
+              "#{match}\n  map.resources #{resource_list}\n"
  348
+            end
347 349
           end
348 350
         end
349 351
 

0 notes on commit 29ec023

Please sign in to comment.
Something went wrong with that request. Please try again.