Created
October 5, 2018 19:50
-
-
Save staycreativedesign/b4d880ffea61d6f4fe14a9a137277fc8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Category.all.each do |category| | |
%li | |
= link_to(category.title, category_path(category)) | |
- unless category.subcategories.blank? | |
%ul | |
- category.subcategories.each do |subcat| | |
%li | |
= link_to(subcat.title, category_subcategory_posts_path(category, subcat)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since you need to have that
<ul>
there only when there are subcategories, it's hard to avoid.One idea I had though… you could unconditionally have the
<ul>
but style it gone when empty: