gist: 2370 Download_button fork
public
Public Clone URL: git://gist.github.com/2370.git
cache.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Created by Nando Vieira
class Cache
  def self.read(key, options=nil)
    Rails.cache.read(key, options)
  end
  
  def self.write(key, value, options=nil)
    Rails.cache.write(key, value, options)
  end
  
  def self.fetch(key, options={}, &block)
    Rails.cache.fetch(key, options, &block)
  rescue ArgumentError => err
    if err.message =~ /undefined class\/module (.*?)$/
      Dependencies.load_missing_constant Kernel, $1.split('::').compact.last
      retry
    end
  end
end

Owner

fnando

Revisions