开发者

How to hide table header in view with no javascript?

Here is a index.html.erb. How do I hide the header, such as Description, with a method in helper file? Preferably without using javascript.

  <tr>
    <th>Category</th>
    <th>Description</th>

  </tr>

Thanks开发者_JAVA技巧.


  <tr>
    <th>Category</th>
    <% if show_desc? %>
      <th>Description</th>
    <% end %>
  </tr>

UPDATE: Another way is to define and use in your view a helper like:

def description
 show_desc? ? "<th>Description</th> : ""
end

You can refactor this method how you like.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜