Help
- Perform_caching is not respected by Rails.cache methods.
config.action_controller.perform_caching does not appear to affect the Rails.cache methods.
Rails 2.1 introduced a new custom caching mechanism:
result = Rails.cache.fetch('key') do
# create and return item for this key
end
It would be really nice if, for testing, you could set a configuration variable that would force a cache miss every time and always execute the block associated with the fetch. However it appears that, understandably, action_controller.perform_caching only affects the kinds of caching implemented by ActionController (page, action, fragment) and not this caching mechanism that is implemented by ActiveSupport::Cache::Store. Looking at the code, is appears there is no way to disable this caching mechanism other than supplying :force => true to the fetch call to force a cache miss.
- W3C refusing to serve DTDs to ‘misbehaving’ clients.
One of our applications that has not been deployed for a while is starting to see issues from IE users. After digging, we found this: W3C’s Excessive DTD Traffic and this w3.org DTD/xhtml1-strict.dtd blocks Windows IE users?. To summarize, w3.org got tired of getting slammed with non-cached DTD requests, and cut off misbehaving user agents (ones that do not cache the DTD). IE is one of these.
We have several things so far, none of which work:
Forcing xhtml DTD to be a SYSTEM dtd, and load the DTD files off the local server. This didn’t work – IE serve the pages as raw unrendered html (must
have thought it was XML?)Use a PUBLIC doctype pointing to the DTD served on our server. Alas, this had the same problem as the SYSTEM doctype in #1 – raw unrendered HTML.
Not using XHTML (e.g. have as root tag). This didn’t work (haven’t
looked into why yet).
Ideas are welcome.
Interesting
- Range#min, Range#max: Don’t use them. Use Range#first and Range#last. Min and max are not overridden by Range so fall back onto Enumerable which then converts the Range into an Array first!
Do you have this XML declaration on the top of your page?
< ?xml version="1.0" encoding="UTF-8"?>
Try removing that. That forces IE into quirks mode which uses a broken box model implementation. This could be the problem if you are using that tag.
May 1, 2009 at 3:21 am
What I do to force a cache miss for tests is I assign a different cache store for the test environment.
Specifically in my config/environments/test.rb I do
config.cache_store = BlackHoleStore.new
the black hole store is something I just created, I pasted it here
http://gist.github.com/104946
Hope this helps.
May 1, 2009 at 9:12 am
@Terjin
Yes, I tried removing the xml element – this was essentially option #3, not using XHTML. This is as simple as using the Markaby “html” method instead of “xhtml”. Unfortunately, this completely broke some of the offline Google Gears pages, and I didn’t investigate whether this was an issue with the page, or with Gears itself (other pages worked fine as non-xhtml).
– Chad
May 4, 2009 at 10:20 pm