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!
Advertisement
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.
4 August 2010 at 4:26 am |
Thanks, fixed a problem we were having with Redmine 0.7.3 on Ubuntu 9.10 … at least long enough for us to upgrade to 10.04 in due course anyway.
8 December 2010 at 1:39 am |
Did you know that USA and Europe blocked Wikileaks? What do you think about it?
Thank you
9 December 2010 at 11:47 pm |
I do not know who is right. I’ll never know. But I know that I hate blocks.
21 January 2011 at 2:57 pm |
Thank you for sharing this, nice quick fix.
26 April 2011 at 1:36 pm |
Thanks!
14 May 2011 at 5:28 pm |
I am working on an old rails 2.0.2 project and i just wanted to say: Thanks a lot!
23 November 2011 at 11:30 am |
Thank you so much..!