aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-01-31 17:55:09 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-01-31 17:55:09 +0000
commit5c0227edc9fe3392a774a52cbeb9ca8cad4a4e65 (patch)
treed60c41b51b4dfcf749f7f85ff00d30d89b27b338 /actionpack/lib/action_view/helpers
parent27bb903aa068fc61c79bec53a7f4d524e935cf0f (diff)
downloadrails-5c0227edc9fe3392a774a52cbeb9ca8cad4a4e65.tar.gz
rails-5c0227edc9fe3392a774a52cbeb9ca8cad4a4e65.tar.bz2
rails-5c0227edc9fe3392a774a52cbeb9ca8cad4a4e65.zip
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
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb2
1 files changed, 1 insertions, 1 deletions
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