Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jakeonrails
Created December 12, 2011 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakeonrails/1469135 to your computer and use it in GitHub Desktop.
Save jakeonrails/1469135 to your computer and use it in GitHub Desktop.
<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