Skip to content

Instantly share code, notes, and snippets.

@jakeonrails
Created December 12, 2011 21:14
Embed
What would you like to do?
<h1>Categories</h1>
<% @categories.each do |category| %>
<ul class="X">
<li>
<h5><%= link_to category.name, category %></h5>
</li>
</ul>
<% end %>
<!-- I need a way to set that "X" class to the ul only when its the current one -->
@jakeonrails
Copy link
Author


<% @categories.each do |category| %>
  <% if category == @current_category %>
    <ul class="X">
  <% else %>
    <ul>
  <% end %>
    <li>.... all the rest of your code

@jakeonrails
Copy link
Author

subroot try putting ``` in front of your code sample so it gets formatted correctly

<% @categories.each do |category| %>
  <% if category == @current_category %>
    <ul class="current">
  <% else %>
    <ul class="category">
  <% end %>
    <li>
      <h5><%= link_to category.name, category %></h5>
    </li>
  </ul>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment