This must be very simple. But I just can't seem to find the proper solution.
I have a model with an embedded video attribute.
I made it happen like this:
On my show page
<iframe width="560" height="315" src="<%= @trip.youtube %>" frameborder="0" allowfullscreen></iframe>
Everything works fine, but the thing is that i don't want to show this part if the youtube url is blank. Otherwise I am left with a huge white space, which I don't need.
I've tried to play around with unless or if conditions
<% if @trip.youtube.blank? %>
<iframe width="0" height="0" src="<%= @trip.youtube %>" frameborder="0" class="hidden" allowfullscreen></iframe>
<% else %>
<iframe width="560" height="315" src="<%= @trip.youtube %>" frameborder="0" allowfullscreen></iframe>
<% end %>
But I'm doing something wrong. Any suggestions for a better way ? Thanks.