I have a textarea that accepts a shipping address, so I need to convert
newlines when it is displayed as html. I am new to ruby, and rails so an
example would be appreciated. I want to do this in the ‘display’, not
the stored text if possible, since I use the newlines when generating a
pdf.
Thanks.
charley
<%= address.gsub(/\n/, ‘
’) %>
-Nb
Nathaniel S. H. Brown http://nshb.net
Or use RedCloth:
gem install redcloth
textilize(address)
You can do as much formatting as you like.
http://whytheluckystiff.net/ruby/redcloth/
-Jonny.