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:
parent
34fcd7943a
commit
6e2d11e00d
|
@ -7,7 +7,8 @@ require 'resolv'
|
||||||
class WikiController < ApplicationController
|
class WikiController < ApplicationController
|
||||||
|
|
||||||
before_filter :load_page
|
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
|
cache_sweeper :revision_sweeper
|
||||||
|
|
||||||
layout 'default', :except => [:atom_with_content, :atom_with_headlines, :atom, :tex, :s5, :export_html]
|
layout 'default', :except => [:atom_with_content, :atom_with_headlines, :atom, :tex, :s5, :export_html]
|
||||||
|
@ -308,6 +309,10 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def do_caching?
|
||||||
|
flash.empty?
|
||||||
|
end
|
||||||
|
|
||||||
def load_page
|
def load_page
|
||||||
@page_name = params['id']
|
@page_name = params['id']
|
||||||
|
|
Loading…
Reference in a new issue