Gemfile に含まれてない gem を rails console で require する方法

More than 1 year has passed since last update.

$LOAD_PATH に lib/ までのフルパスを突っ込めばよい。

$ gem which benchmark/ips

$ be rails c
Loading development environment (Rails 4.1.14)
[1] pry(main)> require 'benchmark/ips'
LoadError: cannot load such file -- benchmark/ips
from /Users/kyanny/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.1.14/lib/active_support/dependencies.rb:247:in `require'
[2] pry(main)> $: << '/Users/kyanny/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/benchmark-ips-2.6.1/lib/'; nil
[3] pry(main)> require 'benchmark/ips'

ruby on rails 3 - How to use a local gem in console with bundled environment - Stack Overflow

Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.