Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # route
- map.sitemap 'sitemap.:format', :controller => 'main', :action => 'sitemap'
- # main controller
- class MainController < ApplicationController
- caches_action :sitemap
- def sitemap
- @posts = Post.find(:all, :include => :comments)
- respond_to do |format|
- format.xml
- end
- end
- end
- #
- # the cached file is created with a double format :(
- # sitemap.xml.xml.cache
- #
Add Comment
Please, Sign In to add comment