Skip to content

Instantly share code, notes, and snippets.

@eric1234
Created May 2, 2014 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eric1234/c9c818b972e0a9af61b8 to your computer and use it in GitHub Desktop.
Save eric1234/c9c818b972e0a9af61b8 to your computer and use it in GitHub Desktop.
Gem.cache polyfill - For running REALLY old Rails applications (1.2.x) under newer versions of RubyGems.
# I put this right after rubygems is loaded in my boot.rb file
def Gem.cache
cache = Object.new
def cache.search name, *requirements
Gem::Specification.find_all_by_name name, *requirements
end
def cache.find *args, &blk
Gem::Specification.all.find *args, &blk
end
cache
end unless Gem.respond_to? :cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment