Skip to content

Instantly share code, notes, and snippets.

@rossnelson
Last active August 29, 2015 14:04
Show Gist options
  • Save rossnelson/217dcbd71bfa66f16dad to your computer and use it in GitHub Desktop.
Save rossnelson/217dcbd71bfa66f16dad to your computer and use it in GitHub Desktop.
How would you make this better?
module Dust
class Sitemap
def self.items
menus.includes(:menu_items).map { |menu| menu.menu_items }.flatten
end
def self.names
Dust.config.menus_on_sitemap.join("|")
end
def self.menus
titles.where('title REGEXP ?', names)
end
def self.titles
Dust::Menu.select('title, id')
end
end
end
@jmejia
Copy link

jmejia commented Jul 23, 2014

items.match_(menu_title).map |menu| 
  menu.menu_items.select('title, url, updated_at') 
end

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