Guest User

Untitled

a guest
Apr 26th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. # route
  2. map.sitemap 'sitemap.:format', :controller => 'main', :action => 'sitemap'
  3.  
  4. # main controller
  5. class MainController < ApplicationController
  6. caches_action :sitemap
  7.  
  8. def sitemap
  9. @posts = Post.find(:all, :include => :comments)
  10. respond_to do |format|
  11. format.xml
  12. end
  13. end
  14. end
  15.  
  16. #
  17. # the cached file is created with a double format :(
  18. # sitemap.xml.xml.cache
  19. #
Add Comment
Please, Sign In to add comment