From 305a5463bd1caf4d0e2f96d39ef3cbbf455788c6 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 17 Jul 2005 10:18:36 +0000 Subject: Added stripping of _id to String#humanize, so "employee_id" becomes "Employee" #1574 [Justin French] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1854 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/core_ext/string/inflections.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activesupport/lib/active_support/core_ext/string') diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb index aa4ff3a74d..65107afaf9 100644 --- a/activesupport/lib/active_support/core_ext/string/inflections.rb +++ b/activesupport/lib/active_support/core_ext/string/inflections.rb @@ -32,6 +32,8 @@ module ActiveSupport #:nodoc: Inflector.classify(self) end + # Capitalizes the first word and turns underscores into spaces and strips _id, so "employee_salary" becomes "Employee salary" + # and "author_id" becomes "Author". def humanize Inflector.humanize(self) end -- cgit v1.2.3