Module: ActionView::Helpers::CacheHelper
- Defined in:
- lib/extended_fragment_cache.rb
Overview
See ActionController::Caching::Fragments for usage instructions.
Instance Method Summary collapse
Instance Method Details
#cache(key, options = {}, interpolation = {}, &block) ⇒ Object
177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/extended_fragment_cache.rb', line 177 def cache(key, ={}, interpolation={}, &block) if key.blank? or (.has_key?(:if) and ![:if]) yield else begin content = @controller.fragment_for(output_buffer, key, , interpolation, &block) || "" rescue MemCache::MemCacheError => err content = "" end interpolation.keys.each{|k| content.sub!(k.to_s, interpolation[k].to_s)} content end end |