Don't Cache Pages With Flash Messages on Them

This was a long-standing annoyance. Fortunately, Rails 2.1 and later offers
a way to avoid it.
This commit is contained in:
Jacques Distler 2008-12-09 02:20:59 -06:00
parent 34fcd7943a
commit 6e2d11e00d

View file

@ -7,7 +7,8 @@ require 'resolv'
class WikiController < ApplicationController
before_filter :load_page
caches_action :show, :published, :authors, :tex, :s5, :print, :recently_revised, :list, :atom_with_content, :atom_with_headlines
caches_action :show, :published, :authors, :tex, :s5, :print, :recently_revised, :list,
:atom_with_content, :atom_with_headlines, :if => Proc.new { |c| c.send(:do_caching?) }
cache_sweeper :revision_sweeper
layout 'default', :except => [:atom_with_content, :atom_with_headlines, :atom, :tex, :s5, :export_html]
@ -309,6 +310,10 @@ class WikiController < ApplicationController
protected
def do_caching?
flash.empty?
end
def load_page
@page_name = params['id']
@page = @wiki.read_page(@web_name, @page_name) if @page_name