This discussion is locked
-
All replies
-
Helpful answers
-
Jun 30, 2010 1:04 PM in response to sh0ttby sh0tt,Figured out the problem...just paste the following code at the end of the environment.rb filemodule ActionView
module Helpers
module TextHelper
def truncate(text, length = 30, truncate_string = "...")
if text.nil? then return end
l = length - truncatestring.chars.toa.size
(text.chars.to_a.size > length ? text.chars.to_a[0...l].join + truncate_string : text).to_s
end
end
end
end -
Sep 22, 2010 5:25 AM in response to sh0ttby fjak,Hi Robert,
I'm having the same exact error but, the fix that you're posting doesn't resolve the issue.
In fact, it makes the server crash on stat-up.
Perhaps it's just the board displaying the information wrongfully.
Would you mind confirming that what we see is what it should be?** Starting Rails with development environment...
Exiting
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gemoriginalrequire': >/XXX/XXX/XXX/review/config/environment.rb:69: syntax error, unexpected tSYMBEG (SyntaxError)
... length ? text.chars.to_ahttp://0...l.join + truncate_string...
/XXX/XXX/XXX/review/config/environment.rb:69: syntax error, unexpected ':', expecting ')'
...0...l.join + truncate_string : text).to_s
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' -
Sep 22, 2010 5:54 AM in response to fjakby fjak,Exactly what I thought.module ActionView
module Helpers
module TextHelper
def truncate(text, length = 30, truncate_string = "...")
if text.nil? then return end
l = length - truncatestring.chars.toa.size
(text.chars.to_a.size > length ? text.chars.to_ah...l.join + truncate_string : text).to_s
end
end
end
end
Be careful, the board code may add "http://..." just after the "to_ah...."
That was my issue from copy/pasting the solution from the top here.
ty