Skip to content

Instantly share code, notes, and snippets.

@lucashungaro
Created August 15, 2011 21:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucashungaro/1147895 to your computer and use it in GitHub Desktop.
Save lucashungaro/1147895 to your computer and use it in GitHub Desktop.
hack to load "system" gems not listed in your Gemfile when using Rails console - add this snippet to your ~/.irbrc
# Add all gems installed in the system to the $LOAD_PATH so they can be used in Rails console with Bundler
if defined?(::Bundler)
current_ruby_version = `rbenv version`.split(" ").first
gem_paths = Dir.glob("#{ENV["HOME"]}/.rbenv/versions/#{current_ruby_version}/lib/ruby/gems/**/gems/*/lib")
gem_paths.each do |path|
$LOAD_PATH << path
end
end
# now you can just normally install these gems ('gem install <gem-name>') into your system and keep your Gemfile listing only your app's dependencies. I use this with wirble, awesome_print and looksee and it works just fine. :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment