RailsCasts Pro episodes are now free!

Learn more or hide this

keithnorm's Profile

GitHub User: keithnorm

Comments by

Avatar

What if instead of displaying "None Give" for missing fields you wanted to not render the field. That would mean something like

users/show.html.erb
<dt>Twitter:</dt>
<dd><%= @user.twitter %></dd>

would have to become

users/show.html.erb
<% if @user.twitter %>
    <dt>Twitter:</dt>
    <dd><%= @user.twitter %></dd>
<% end %>

or just

users/show.html.erb
<%= @user.twitter %>

and have the presenter output the container markup, which I don't really like. Wondering if there was any cleaner way to do that? Thanks!