I’m trying to create a simple method in a model to create a multi-line
address from discrete input fields:
[address1, address2, address3, city, postcode].compact.join(’\n’)
However, the line break is appearing in the view as the string “\n”,
not a line break ( “address1\naddress2\naddress3\ncity\npostcode”). I
can’t figure out what I need to do to get line breaks. What am I
Also, compact only seems to remove null values, not empty values. The
form I use converts null values to empty values when it is saved, so I
end up with something like this if address3 is empty:
address1, address2, , city, postcode
Is there a way around this?
Thanks for any help.