aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/generators/erb/scaffold/templates/index.html.erb2
-rw-r--r--railties/lib/generators/rails/scaffold_controller/templates/controller.rb4
-rw-r--r--railties/lib/rails/generators/named_base.rb4
3 files changed, 7 insertions, 3 deletions
diff --git a/railties/lib/generators/erb/scaffold/templates/index.html.erb b/railties/lib/generators/erb/scaffold/templates/index.html.erb
index b5c7fd1e58..d30d306d42 100644
--- a/railties/lib/generators/erb/scaffold/templates/index.html.erb
+++ b/railties/lib/generators/erb/scaffold/templates/index.html.erb
@@ -24,4 +24,4 @@
<br />
-<%%= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path %>
+<%%= link_to 'New <%= human_name %>', new_<%= singular_name %>_path %>
diff --git a/railties/lib/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/generators/rails/scaffold_controller/templates/controller.rb
index 874e96a2b4..bbdce669dc 100644
--- a/railties/lib/generators/rails/scaffold_controller/templates/controller.rb
+++ b/railties/lib/generators/rails/scaffold_controller/templates/controller.rb
@@ -46,7 +46,7 @@ class <%= controller_class_name %>Controller < ApplicationController
respond_to do |format|
if @<%= orm_instance.save %>
- format.html { redirect_to(@<%= file_name %>, :notice => '<%= class_name %> was successfully created.') }
+ format.html { redirect_to(@<%= file_name %>, :notice => '<%= human_name %> was successfully created.') }
format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> }
else
format.html { render :action => "new" }
@@ -62,7 +62,7 @@ class <%= controller_class_name %>Controller < ApplicationController
respond_to do |format|
if @<%= orm_instance.update_attributes("params[:#{file_name}]") %>
- format.html { redirect_to(@<%= file_name %>, :notice => '<%= class_name %> was successfully updated.') }
+ format.html { redirect_to(@<%= file_name %>, :notice => '<%= human_name %> was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb
index 12e918731e..8d1dfbd947 100644
--- a/railties/lib/rails/generators/named_base.rb
+++ b/railties/lib/rails/generators/named_base.rb
@@ -27,6 +27,10 @@ module Rails
@class_name ||= (class_path + [file_name]).map!{ |m| m.camelize }.join('::')
end
+ def human_name
+ @human_name ||= singular_name.humanize
+ end
+
def plural_name
@plural_name ||= singular_name.pluralize
end