I have a system for the users to be able to post comments.
The comments are grasped into a textarea.
My problem is to format the comments with br tag to replace
As Ryan Bigg suggested simple_format
is the best tool for the job: it's 'l safe' and much neater than other solutions.
so for @var:
<%= simple_format(@var) %>
If you need to sanitize the text to get rid of HTML tags, you should do this before passing it to simple_format
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#method-i-simple_format