aboutsummaryrefslogtreecommitdiffstats
path: root/railties/generators
diff options
context:
space:
mode:
Diffstat (limited to 'railties/generators')
-rw-r--r--railties/generators/controller/controller_generator.rb4
-rw-r--r--railties/generators/controller/templates/controller.rb2
-rw-r--r--railties/generators/controller/templates/functional_test.rb6
-rw-r--r--railties/generators/scaffold/scaffold_generator.rb4
4 files changed, 12 insertions, 4 deletions
diff --git a/railties/generators/controller/controller_generator.rb b/railties/generators/controller/controller_generator.rb
index 4b53741565..79f9a7e03b 100644
--- a/railties/generators/controller/controller_generator.rb
+++ b/railties/generators/controller/controller_generator.rb
@@ -19,4 +19,8 @@ class ControllerGenerator < Rails::Generator::Base
template "view.rhtml", "app/views/#{file_name}/#{action}.rhtml", binding
end
end
+
+ def full_class_name
+ class_name + "Controller"
+ end
end
diff --git a/railties/generators/controller/templates/controller.rb b/railties/generators/controller/templates/controller.rb
index da71b5f057..0daf04b348 100644
--- a/railties/generators/controller/templates/controller.rb
+++ b/railties/generators/controller/templates/controller.rb
@@ -1,4 +1,4 @@
-class <%= class_name %>Controller < ApplicationController
+class <%= full_class_name %> < ApplicationController
<% if options[:scaffold] -%>
scaffold :<%= singular_name %>
<% end -%>
diff --git a/railties/generators/controller/templates/functional_test.rb b/railties/generators/controller/templates/functional_test.rb
index c975cb3ce3..df75ad57e9 100644
--- a/railties/generators/controller/templates/functional_test.rb
+++ b/railties/generators/controller/templates/functional_test.rb
@@ -2,11 +2,11 @@ require File.dirname(__FILE__) + '/../test_helper'
require '<%= file_name %>_controller'
# Re-raise errors caught by the controller.
-class <%= class_name %>Controller; def rescue_action(e) raise e end; end
+class <%= full_class_name %>; def rescue_action(e) raise e end; end
-class <%= class_name %>ControllerTest < Test::Unit::TestCase
+class <%= full_class_name %>Test < Test::Unit::TestCase
def setup
- @controller = <%= class_name %>Controller.new
+ @controller = <%= full_class_name %>.new
@request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
end
diff --git a/railties/generators/scaffold/scaffold_generator.rb b/railties/generators/scaffold/scaffold_generator.rb
index ee556e8a03..55bb835bb7 100644
--- a/railties/generators/scaffold/scaffold_generator.rb
+++ b/railties/generators/scaffold/scaffold_generator.rb
@@ -34,6 +34,10 @@ class ScaffoldGenerator < Rails::Generator::Base
end
end
+ def full_class_name
+ class_name + "Controller"
+ end
+
protected
def scaffold_views
%w(list show new edit)