From 38ee39a4a5e719694dca553ef739dbf99645c2b2 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 22 Jan 2005 14:39:03 +0000 Subject: Fixed that generate scaffold would produce bad functional tests git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@474 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/generators/scaffold/scaffold_generator.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'railties/generators/scaffold/scaffold_generator.rb') diff --git a/railties/generators/scaffold/scaffold_generator.rb b/railties/generators/scaffold/scaffold_generator.rb index 00dd27c5ed..3901d6b2bc 100644 --- a/railties/generators/scaffold/scaffold_generator.rb +++ b/railties/generators/scaffold/scaffold_generator.rb @@ -9,16 +9,16 @@ class ScaffoldGenerator < Rails::Generator::Base template "fixtures.yml", "test/fixtures/#{table_name}.yml" @controller_class_name = args.empty? ? Inflector.pluralize(class_name) : args.shift.sub(/^[a-z]?/) { |m| m.capitalize } - controller_name = Inflector.underscore(@controller_class_name) + @controller_name = Inflector.underscore(@controller_class_name) # Controller class, functional test, helper, and views. - template "controller.rb", "app/controllers/#{controller_name}_controller.rb" - template "functional_test.rb", "test/functional/#{controller_name}_controller_test.rb" - template "controller/helper.rb", "app/helpers/#{controller_name}_helper.rb" + template "controller.rb", "app/controllers/#{@controller_name}_controller.rb" + template "functional_test.rb", "test/functional/#{@controller_name}_controller_test.rb" + template "controller/helper.rb", "app/helpers/#{@controller_name}_helper.rb" # Layout and stylesheet. - unless File.file?("app/views/layouts/#{controller_name}.rhtml") - template "layout.rhtml", "app/views/layouts/#{controller_name}.rhtml" + unless File.file?("app/views/layouts/#{@controller_name}.rhtml") + template "layout.rhtml", "app/views/layouts/#{@controller_name}.rhtml" end unless File.file?("public/stylesheets/scaffold.css") template "style.css", "public/stylesheets/scaffold.css" @@ -26,13 +26,13 @@ class ScaffoldGenerator < Rails::Generator::Base # Scaffolded views. scaffold_views.each do |action| - template "view_#{action}.rhtml", "app/views/#{controller_name}/#{action}.rhtml" + template "view_#{action}.rhtml", "app/views/#{@controller_name}/#{action}.rhtml" end # Unscaffolded views. unscaffolded_actions.each do |action| template "controller/view.rhtml", - "app/views/#{controller_name}/#{action}.rhtml", + "app/views/#{@controller_name}/#{action}.rhtml", binding end end -- cgit v1.2.3