Module: Sitemapper::Adapters::RailsAdapter

Defined in:
lib/sitemapper/adapters/rails_adapter.rb

Defined Under Namespace

Modules: RoutesMapperExtension

Class Method Summary collapse

Class Method Details

.install!Object

Install routing hooks, view helpers and initialize the sitemap.xml file



45
46
47
48
49
50
51
52
53
# File 'lib/sitemapper/adapters/rails_adapter.rb', line 45

def self.install!
  Sitemapper::site_root = ActionController::Base.relative_url_root rescue
                              ActionController::AbstractRequest.relative_url_root
  Sitemapper::map_index = Sitemapper::MapIndex.new(File.join(Rails.root, 'public', 'sitemap_index.xml.gz'))
  Sitemapper::map = Sitemapper::map_index.build_map(File.join(Rails.root, 'public', 'sitemap_dynamic.xml.gz'))
  ActionController::Routing::RouteSet::Mapper.send :include, RoutesMapperExtension
  ActionView::Base.send :include, Sitemapper::Helpers
  ActionController::Base.send :include, Sitemapper::Accessors
end