Truncate at end-of-string, not at every EOL

This commit is contained in:
Owen Marshall 2015-07-31 09:03:10 -04:00
parent 09f65774c2
commit 8fae63929d

View file

@ -230,7 +230,7 @@ class Story < ActiveRecord::Base
if chars > 0
# remove last truncated word
s = s.to_s[0, chars].gsub(/ [^ ]*$/, "")
s = s.to_s[0, chars].gsub(/ [^ ]*\z/, "")
end
HTMLEntities.new.decode(s.to_s)