SyntaxHighlighter

Sunday, April 03, 2011

String Truncate

Here's a truncate method that's a little smarter than the one that comes with rails. It won't cut off in the middle of a word. Just put this code in a file (like string_initializers.rb) and put that your initializers folder under config.