From 3229b59495270a094d3a0f83814f1c3d5ebec7e3 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 3 Jan 2008 00:16:47 +0000 Subject: Fixed String#titleize to work for strings with 's too (closes #10571) [trek] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8533 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/inflector.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb index baa342f669..ee5d5753c9 100644 --- a/activesupport/lib/active_support/inflector.rb +++ b/activesupport/lib/active_support/inflector.rb @@ -162,7 +162,7 @@ module Inflector # "man from the boondocks".titleize #=> "Man From The Boondocks" # "x-men: the last stand".titleize #=> "X Men: The Last Stand" def titleize(word) - humanize(underscore(word)).gsub(/\b([a-z])/) { $1.capitalize } + humanize(underscore(word)).gsub(/\b('?[a-z])/) { $1.capitalize } end # The reverse of +camelize+. Makes an underscored form from the expression in the string. -- cgit v1.2.3