How do i stop rails from cacheing a link


#1

I’ve got a controller that saves changes to a file and displays the
file…

well, the controller the saves the file renders the controller that
displays the file after it saves the file (i’m sure there’s a better way
to do this but i haven’t figured it out yet).

at the bottom of the displayed file there is a link to refresh the page
to reload the file… the problem is, unless i manually refresh the
browser, i wont see any changes. it just keeps an old version… even
if i just made a change to the file, it will still display the version
before the change…

now i’m assuming this is rails wanting to be nice and cache stuff to
make it quicker… but it’s annoying the hell out of me.

so here’s how it goes.

1.read a file with the fileread action.
2.make changes and submit to the filewrite action which renders the
fileread action and shows the changes just fine.
3.click the refresh link which goes to the fileread action and the file
reverts back to before the changes…
4.Hit the refresh button on the browser and now the fileread action
actually shows changes…

i can click the refresh link all i want and it still shows no change.


#2

Morgan M. wrote:

I’ve got a controller that saves changes to a file and displays the
file…

well, the controller the saves the file renders the controller that
displays the file after it saves the file (i’m sure there’s a better way
to do this but i haven’t figured it out yet).

at the bottom of the displayed file there is a link to refresh the page
to reload the file… the problem is, unless i manually refresh the
browser, i wont see any changes. it just keeps an old version… even
if i just made a change to the file, it will still display the version
before the change…

now i’m assuming this is rails wanting to be nice and cache stuff to
make it quicker… but it’s annoying the hell out of me.

so here’s how it goes.

1.read a file with the fileread action.
2.make changes and submit to the filewrite action which renders the
fileread action and shows the changes just fine.
3.click the refresh link which goes to the fileread action and the file
reverts back to before the changes…
4.Hit the refresh button on the browser and now the fileread action
actually shows changes…

i can click the refresh link all i want and it still shows no change.

i didn’t reread this before i posted it.

well, the controller the saves the file renders the controller that
displays the file after it saves the file (i’m sure there’s a better way
to do this but i haven’t figured it out yet).

should be

well, the action that saves the file renders the action that
displays the file after it saves the file (i’m sure there’s a better way
to do this but i haven’t figured it out yet).


#3

Morgan M. wrote:

now i’m assuming this is rails wanting to be nice and cache stuff to
make it quicker… but it’s annoying the hell out of me.

I’m guessing you’re assuming wrong here. Rails has nothing to do with
it. It’s going to be the client’s browser that caches the file, unless
the response tells the browser not to cache it.

Here a nice tutorial on caching that might help you:
http://www.mnot.net/cache_docs/