16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/cachier/controller_helper.rb', line 16
def self.included(klass)
klass.class_eval do
def write_fragment_with_tagged_key(key, content, options = nil)
if options && options[:tag] && Cachier.perform_caching?
tags = case options[:tag].class.to_s
when 'Proc', 'Lambda'
options[:tag].call(self)
else
options[:tag]
end
Cachier.store_fragment fragment_cache_key(key), *tags
end
write_fragment_without_tagged_key(key, content, options)
end
alias_method_chain :write_fragment, :tagged_key
end
end
|