How to fix caching

Hi all,

Basically I need to turn off caching on 100%, but maybe something else
will help.

I have a next problem -

in main layout:
<% if current_user and current_user != :false %>

<% else %>

<% end %>

if I login all works fine, I see “Hi user”, but when I press logout
link, page redirected to “/”, and I see same “Hi user” text. (when I
reload page with ctrl+F5 page reloaded to valid, with “login please”
text)
Server returns 304, but how this can possible? page must be with other
content.

I use next tags in layout -

and put next cofig into the \config\environments\ -
config.cache_classes = false
config.action_controller.perform_caching = false

I see this bug in WEBrick (dev) and in Mongrel (production), with same
configs and templates.

How I can say to browser always reload a html? or to ROR - not use 304
status, always re-render html?

He, found a method to fix this:
in application.rb -

before_filter … , :set_header

protected
def set_header
# set modify date to current timestamp
response.headers[“Last-Modified”] = CGI::rfc1123_date(Time.now -
1000)
# set expiry to back in the past
# (makes us a bad candidate for caching)
response.headers[“Expires”] = 0
# HTTP 1.0 (disable caching)
response.headers[“Pragma”] = “no-cache”
# HTTP 1.1 (disable caching of any kind)
# HTTP 1.1 ‘pre-check=0, post-check=0’ (IE specific)
response.headers[“Cache-Control”] = “no-cache, no-store,
must-revalidate, pre-check=0, post-check=0”
end

Good in IE and FF, but sometimes not helps in Opera.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs