aboutsummaryrefslogtreecommitdiffstats
path: root/railties/generators/scaffold
diff options
context:
space:
mode:
Diffstat (limited to 'railties/generators/scaffold')
-rw-r--r--railties/generators/scaffold/scaffold_generator.rb16
-rw-r--r--railties/generators/scaffold/templates/functional_test.rb8
2 files changed, 12 insertions, 12 deletions
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
diff --git a/railties/generators/scaffold/templates/functional_test.rb b/railties/generators/scaffold/templates/functional_test.rb
index 1bf7d83694..004af030be 100644
--- a/railties/generators/scaffold/templates/functional_test.rb
+++ b/railties/generators/scaffold/templates/functional_test.rb
@@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../test_helper'
-require '<%= file_name %>_controller'
+require '<%= @controller_name %>_controller'
# Re-raise errors caught by the controller.
-class <%= class_name %>Controller; def rescue_action(e) raise e end; end
+class <%= @controller_class_name %>Controller; def rescue_action(e) raise e end; end
-class <%= class_name %>ControllerTest < Test::Unit::TestCase
+class <%= @controller_class_name %>ControllerTest < Test::Unit::TestCase
fixtures :<%= table_name %>
def setup
- @controller = <%= class_name %>Controller.new
+ @controller = <%= @controller_class_name %>Controller.new
@request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
end