I'm sure others have run into this, but using conditional GETs has
some fun side effects if you're rendering a page that has a flash
message and the (browser) cached version doesn't contain the flash,
the user never sees the flash and vice-versa if the browser cached
page has a flash the flash is displayed for as long as the page is
cached.
Nothing new there though, it's caching 101, but I'm wondering if it
makes sense to accommodate for this in the ActionController helpers
(fresh?/stale?/fresh_when, by either setting another etag/modified if
the flash hash is non-empty or always including the flash hash's
checksum as part of the etag. What's the general opinion here, is this
something that should be left up to the developer or should rails
handle this?
Nothing new there though, it's caching 101, but I'm wondering if it
makes sense to accommodate for this in the ActionController helpers
(fresh?/stale?/fresh_when, by either setting another etag/modified if
the flash hash is non-empty or always including the flash hash's
checksum as part of the etag. What's the general opinion here, is this
something that should be left up to the developer or should rails
handle this?
I don't think it's something we should bake in. There are many other
session or environment variables that could control the view as well.
If you're doing conditional get on a page, you need to make sure that
all the variables that controls the look of that page is included in
the cache key. Whether it's a record, a flash message, another session
variable, or whatever.