If this is a Ruby application you could do the following:
Code:
company.address_lines.compact.join(",\n")
That will give
Code:
address_1,
address_2,
address_3,
city,
state,
zip,
zip4
If it is a Rails app then this will put a comma in as well as the new line break I put in my original
Code:
company.address_lines.compact.join(",\n<br />")
This will give
Code:
address_1,
<br />address_2,
<br />address_3,
<br />city,
<br />state,
<br />zip,
<br />zip4
For the zip code, I'd add another class/model method to company:
Code:
def full_zip
[zip4, zip].join("-")
end
I'm not sure which way zip and zip4 should go as that looks nothing like the post codes we use this side of the pond. Then update the address_lines method to
Code:
def address_lines
[address_1, address_2, address_3, city, state, full_zip]
end
Bookmarks