Skip to content

Instantly share code, notes, and snippets.

@PikachuEXE
Created December 6, 2013 05:47
Embed
What would you like to do?
#lib/routing.rb
# SO: http://stackoverflow.com/questions/16720514/how-to-use-url-helpers-in-lib-modules-and-set-host-for-multiple-environments
module Routing
extend ActiveSupport::Concern
include Rails.application.routes.url_helpers
included do
def default_url_options
{ :locale => I18n.locale }
end
end
end
# config/sitemap.rb
require Rails.root.join('lib/routing.rb')
### Logic of generating the sitemap
SitemapGenerator::Interpreter.send :include, Routing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment