I have a feeds controller which generates RSS and Atom pages. I put
‘caches_page :show’ in it. The problem is that the pages are saved with
an html extension. As a result, browsers display the cached feeds as
HTML rather than XML, and feed validators complain.
There’s an option to set ‘Base.page_cache_extension’ globally, but I
don’t want to do that for everything. I also tried setting that option
just in the show method, but that doesn’t work. How can I get the cached
pages for just Feeds#show get saved with xml/rss/atom extensions?
don’t want to do that for everything. I also tried
setting that option
just in the show method, but that doesn’t work. How
can I get the cached
pages for just Feeds#show get saved with
xml/rss/atom extensions?
I’ve made some progress. Changing
@@page_cache_extension to ‘.xml’ in the controller
causes the cache files to get saved with an xml
entension. However, I can’t get them to get used. I
added this to my .htaccess:
But those cache files STILL aren’t getting used. The
above ruleset should cause EVERY request sans file
extension to get rewritten to $1.xml, but it
apparently isn’t working. I have no idea why. Only
.html works. I’m using webrick (in production mode).
Any ideas?
Thanks,
csn
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.