Forum: Ruby on Rails page caching with custom routes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Klaas debeuf (Guest)
on 2006-06-14 12:06
hi ,

I'm having problems with expire_page with custom routes
i'll show some code

blog_controller
---------------
  def clear_cache_rss_artikels
    expire_page url_for(:controller => "xml",:action => "rss_artikels")
  end

this is called when a new article is posted or edited or destroyed

xml_controller
---------------
class XmlController < ApplicationController
  caches_page :rss_artikels

  def rss_artikels
    @articles = Article.find(:all)
  end

end

routes.rb
----------
map.rss "rss/blog/artikels",:controller => "xml",:action =>
"rss_artikels"

when the rss feed is called , rails make a file in the public directory
rss/blog/artikels.html

but i can't expire the page ,i think something is wrong with
clear_cache_rss_artikels , the routes aren't called at the moment when
expired_page is called or could somebody help me?

greetz

Klaas
Simon King (Guest)
on 2006-07-09 19:06
(Received via mailing list)
Hi Klaas

I don't think you need to call the url_for() method. Your expire
method should look like:

def clear_cache_rss_artikels
    expire_page(:controller => "xml",:action => "rss_artikels")
end

Hope this helps,
Simon
This topic is locked and can not be replied to.