OK, stupid newbie question: how do you make a line break only when it's needed?
I'm creating a basic address listing and only want to include a line of an address if it isn't blank. How do I keep the blank line from printing? I've tried including the break and new line tags, and tried using puts and quotation marks of both varieties and escaping the slashes but can't seem to display the address correctly.
Is there a way to have each line of the address to print on its own line or simply omit the line if there is no info to put on it?
Here's the current version of the code:
<p><strong>Main Address</strong></p>
<p><%= if @vendor.address1 || null
@vendor.address1 #need a break here
end %>
<%= if @vendor.address2 || null
@vendor.address2 #need a break here
end %>
<%= @vendor.city %>, <%= @vendor.state %> <%= @vendor.zip %></p>
` tags and newline chars? – Michael Berkowski Sep 10 '12 at 02:44