ERB Template removing the trailing line
- by KandadaBoggu
I have an ERB template for sending an email.
Name: <%= @user.name %>
<% unless @user.phone.blank? %>
Phone: <%= @user.phone %>
<% end %>
Address: <%= @user.address %>
When the user hasn't set the phone then the email body is as follows:
Name: John Miller
Address: X124 Dummy Lane, Dummy City, CA
I am trying to remove the blank line between Name and Address when Phone is empty.
Name: John Miller
Address: X124 Dummy Lane, Dummy City, CA
I have tried to use <%--%> tags(to remove the trailing new line) without any success.
Name: <%= @user.name %>
<%- unless @user.phone.blank? -%>
Phone: <%= @user.phone %>
<%- end -%>
Address: <%= @user.address -%>
How do I work around this issue?