Skip to content

Instantly share code, notes, and snippets.

@paul
Created October 22, 2008 22:02
Show Gist options
  • Save paul/18816 to your computer and use it in GitHub Desktop.
Save paul/18816 to your computer and use it in GitHub Desktop.
def require(path) # :nodoc:
gem_original_require path
rescue LoadError => load_error
if load_error.message =~ /#{Regexp.escape path}\z/ and
spec = Gem.searcher.find(path) then
Gem.activate(spec.name, "= #{spec.version}")
gem_original_require path
else
raise load_error
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment