I am trying to add a linebreak to a text object in rails.
Using rails 5.0 and postgres 9.4
some_text = "string sentence one"
some_text += #how do i add line break here
some_text = "string sentence two"
I've tried chr(10), '\n', \n, '/\n/' and /\n/
How would I add a line break to some_text?
tl;dr
Below is a loop that I am using in a controller to loop through attributes of an object and try to add a line break to it
@some_text ||= ""
object.attributes.each do |attr_name, attr_value|
@some_text << attr_value.to_s + "\n"
end
When I display the @some_text object in a view, it has no line breaks. If I save the @some_text object into postgres, it still has no line breaks.