Skip to content

Instantly share code, notes, and snippets.

@freshtonic
Forked from lachlanhardy/gist:76696
Created March 10, 2009 06:56
Show Gist options
  • Save freshtonic/76787 to your computer and use it in GitHub Desktop.
Save freshtonic/76787 to your computer and use it in GitHub Desktop.
# So this is in my controller:
@items = Dir.glob("views/*/*").map do |item|
item.gsub(/views\/.+\/(.+).haml/, '\1')
end.select do |item|
!item.match(/^hide-/) && x != "index")
end
# Its contents look like this:
# views/controls/actions.haml
# views/controls/buttons.haml
# views/controls/formForge.haml
# views/controls/hide-actions.haml
# views/controls/index.haml
# views/controls/navigation.haml
# views/controls/tree.haml
# views/dialogs/browser.haml
# views/dialogs/dialogBox.haml
# No need to check if @items exists, it will be an empty array at least.
- @items.each do |item|
%p do some stuff with item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment