Skip to content

Instantly share code, notes, and snippets.

@szymon-przybyl
Created May 26, 2011 18:44
Show Gist options
  • Save szymon-przybyl/993759 to your computer and use it in GitHub Desktop.
Save szymon-przybyl/993759 to your computer and use it in GitHub Desktop.
partial local
def self.roots
where(:parent_id => nil)
end
%ul#menu= render 'shared/categories_menu', :locals => { :categories => Category.roots }
- categories.each do |category|
%li
= link_to category.name, category
- unless category.children.empty?
%ul= render 'shared/categories_menu', :locals => { :categories => category.children }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment