aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails_generator
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-12-26 19:39:30 +0000
committerRick Olson <technoweenie@gmail.com>2006-12-26 19:39:30 +0000
commit29ec023adde3bf174f4f256d1ca34b68c7a1502a (patch)
tree23b4b6d73a43ca54ea365f007d203d3e5474c71d /railties/lib/rails_generator
parentef1232c478691a5c58105435deb31cbd4c973f8b (diff)
downloadrails-29ec023adde3bf174f4f256d1ca34b68c7a1502a.tar.gz
rails-29ec023adde3bf174f4f256d1ca34b68c7a1502a.tar.bz2
rails-29ec023adde3bf174f4f256d1ca34b68c7a1502a.zip
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
Diffstat (limited to 'railties/lib/rails_generator')
-rw-r--r--railties/lib/rails_generator/commands.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb
index 8db14302da..783d9aeb3a 100644
--- a/railties/lib/rails_generator/commands.rb
+++ b/railties/lib/rails_generator/commands.rb
@@ -342,8 +342,10 @@ module Rails
sentinel = 'ActionController::Routing::Routes.draw do |map|'
logger.route "map.resources #{resource_list}"
- gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
- "#{match}\n map.resources #{resource_list}\n"
+ unless options[:pretend]
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
+ "#{match}\n map.resources #{resource_list}\n"
+ end
end
end