I have run into a bit of a caching problem. I’m building a website that
mostly consists of static editable pages. There is a basic
authentication system to restrict who is able to edit the pages and so
on. If you’re logged in, an edit and a destroy link will show up.
This is my problem: If you’re logged in and a page hasn’t been cached
yet, it will be cached with edit/destroy links for everyone else to see.
They can’t edit the pages anyway, so what are they going to need the
links for? And if the page has been cached by a regular user, the
administrator can’t see the links.
And also, when the admin presses “Log in”, I want a flash message to
show up telling him that he has logged in successfully. Again: If the
page hasn’t been cached yet, the flash message will be visible to
everyone. If the page wasn’t cached before, the flash messages won’t
Does this mean that flash messages and authentication is an impossible
combination? Is there any way to work around this?