From 5c0227edc9fe3392a774a52cbeb9ca8cad4a4e65 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 31 Jan 2007 17:55:09 +0000 Subject: Make sure that the string returned by TextHelper#truncate is actually a string, not a char proxy -- that should only be used internally while working on a multibyte-safe way of truncating [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6096 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/text_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index e60f6c2986..1698598edb 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -35,7 +35,7 @@ module ActionView def truncate(text, length = 30, truncate_string = "...") if text.nil? then return end l = length - truncate_string.chars.length - text.chars.length > length ? text.chars[0...l] + truncate_string : text + (text.chars.length > length ? text.chars[0...l] + truncate_string : text).to_s end # Highlights +phrase+ everywhere it is found in +text+ by inserting it into -- cgit v1.2.3