With rails 2.0.2 and ruby 1.8.7 you can find this error using rails truncate helper
To solve this problem, paste this code in your enviroment.rb (eof).
module ActionView
module Helpers
module TextHelper
def truncate(text, length = 30, truncate_string = "...")
if text.nil? then return end
l = length - truncate_string.chars.to_a.size
(text.chars.to_a.size > length ? text.chars.to_a[0...l].join + truncate_string : text).to_s
end
end
end
end
Have a nice day!
Tags: rails2.0.2, RoR, Ruby on Rails, ruby1.8.7, truncate helper error
10 December 2008 at 4:42 am |
Thank you.
Fixed my Redmine installation havoc with this enlightenment.
21 February 2009 at 6:54 pm |
Thank you, helped with redmine also
11 March 2009 at 4:56 pm |
Thanks so much this code make posible run some old software based on ruby on rails thanks a lot man
28 March 2009 at 10:39 am |
Woo, that fixed it. Thank you
4 April 2009 at 7:31 am |
Thank you for sharing this, nice quick fix.
12 May 2009 at 6:22 am |
Hey…
Nice tip.
Thanks!
29 July 2009 at 12:22 pm |
Thanks alot, on Ubuntu 9.04 (gems from src) this fix work ok.
19 November 2009 at 10:14 pm |
I was having the same symptom with Warehouse and although I don’t know how to get the error this fix worked for it. Thanks!
23 November 2009 at 1:25 pm |
Thanks for posting the fix.
25 May 2010 at 10:52 am |
Thanks.
It really helped me.