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.
精彩评论