This project is archived and is in readonly mode.
ActionView::Base.computed_public_paths cacheing not consistent with ActionController::Base.perform_caching = false
Reported by Tim Harper | October 19th, 2008 @ 08:14 AM
In essence:
- I load a page (in development mode) - it looks pretty
- I change the CSS file some
- I go back to the browser and hit "refresh"
- My CSS change doesn't take effect. The browser is using a completely cached version of the css file.
- I restart my web server
- I refresh the browser
- The CSS change takes.
This all happens because ActionView::Base.computed_public_paths effectively caches the timestamp querystring, rendering the timestamped querystring ineffective at forcing the browser to reload a changed asset file.
The following monkey patch fixes the problem:
unless ActionController::Base.perform_caching ActionController::Dispatcher.class_eval do before_dispatch :clear_computed_public_paths def clear_computed_public_paths ActionView::Base.computed_public_paths.clear end end end
Comments and changes to this ticket
-
Pratik October 19th, 2008 @ 10:02 AM
- Assigned user set to josh
-
josh October 19th, 2008 @ 10:04 PM
- State changed from new to open
- Milestone cleared.
Thats probably the best solution. Can you patch that in the development mode dispatcher callback.
-
Tim Harper October 20th, 2008 @ 07:25 AM
Looks like the internals have changed quite a bit in rails EDGE since 2.1, but the issue still manifests
Here's my patch, complete with a test:
http://github.com/timcharper/rai...
I also tested this by hand to verify that this commit causes timestamps to update automatically in asset urls, and, it does, just like grandma used to make it.
-
Repository October 20th, 2008 @ 07:22 PM
- State changed from open to resolved
(from [fcb45e5ec3c8ab7b11391c0639609918876ddbb2]) Ensure ActionView::Helpers::AssetTagHelper::AssetTag::Cache is cleared before loading so changes to asset files are picked up by the broswer [#1233 state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
-
salil February 25th, 2009 @ 03:25 PM
i am new to ruby i am facing the same problem as TIM.i changing my css files and images used in a css but my html page not changes because of cache. i don't know where to use above code. i.e. unless ActionController::Base.perform_caching
Thanks
IF YOU ASK YOU FOOL FOR 15 min. but IF YOU Don't YOU 'll b FOOL FOREVER.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Tags
Referenced by
- 1233 ActionView::Base.computed_public_paths cacheing not consistent with ActionController::Base.perform_caching = false (from [fcb45e5ec3c8ab7b11391c0639609918876ddbb2]) Ensure ...