I want to truncate a string as follows:
input:
string = \"abcd asfsa sadfsaf safsdaf aaaaaaaaaa aaaaaaaaaa ffffdffffdffffdffffddd\"
You can do almost the same without Rails:
text.gsub(/^(.{50,}?).*$/m,'\1...')
50 is the length you need.
50