I have an array..
[1,2,3,4]
and I want a string containing all the elements separated by a newline..
1
2
3
4
As some of the other answers above imply, Rails may be escaping your code before rendering as html. Here's a sample that addresses this problem (first sanitizing the inputs, so that you can "safely" call html_safe on the result):
my_array = [1, 2, 3, 4]
my_array.map{ |i| i.to_s.sanitize }.join("\n").html_safe
You only need sanitize if you don't trust the inputs.