305
by Jacques Distler
Drop hostname from cache key
1
# based on http://pastie.org/49840
2
# override the fragment_cache_key method in actionpack/lib/action_controller/caching/fragments.rb
3
# to remove hostname in fragment caching
4
# so instead of caching different fragments for "example.com/posts/list" and
5
# "www.example.com/posts/list", instead it will just use "posts/list"
7
module ActionController
10
def fragment_cache_key(key)
539
by Jacques Distler
Fix Caching
11
ActiveSupport::Cache.expand_cache_key(key.is_a?(Hash) ? url_for(key.merge(:host=>"")).split(":///").last : key.split('/')[1..-1].join('/').gsub(/\?format=.*/,''), :views)
305
by Jacques Distler
Drop hostname from cache key
12
end
18
ActionController::Base.class_eval do
19
include CachingStuff::ActionController::Caching::Fragments