0
使用Rails 3.這是一個前端設計問題。如果上一個元素存在,則添加間隔文本
目標:
Contact | Email | URL
show.html.erb:
<% if [email protected]? %>
<%= @shop.contact %>
<% end %>
<% if [email protected]? %>
<%= @shop.email %>
<% end %>
<% if [email protected]? %>
<%= link_to @shop.url, @shop.url, :target => "_blank" %>
<% end %>
如何把在|
只有當後的以前和元素具有價值?在現階段,如果沒有價值,則不會輸出任何結果。
非常感謝。
效果很好。但遺憾的是我遺漏了'link_to'標籤。想要修改你的答案?謝謝。 – Victor
@Victor我編輯了我的答案。但下一次,你應該把你的整個問題都置於這個問題上。 –
感謝您的更新。對不起,麻煩您了。再次感謝。 – Victor