From Justing Weiss’s article:
What’s the Difference Between irb, bundle exec irb, bundle console, and rails console?
It can’t easily load gems that Bundler installs outside of RubyGems’ load path. Eg. bundle install --path=vendor/bundle
It can easily load Gemfile gems by Bundler.
1
2
3
| $ irb
>> require 'bundler/setup'
=> true
|
Find and auto-require Gemfile gems.
1
2
3
4
5
6
7
8
9
10
11
| $ irb
>> require 'bundler/setup'
=> true
>> Rails.version
NameError: uninitialized constant Rails
from (irb):2
from /Users/wendi/.rvm/rubies/ruby-2.0.0-p353/bin/irb:12:in '<main>'
>> Bundler.require
=> [<Bundler::Dependency type=:runtime name="rails" requirements="= 4.1.6">, ... ]
>> Rails.version
=> "4.1.6"
|
Find, auto-require Gemfile gems and load Rails Application env.
1
2
3
4
5
6
7
8
9
10
11
12
13
| $ irb
>> require 'bundler/setup'
=> true
>> Rails.version
NameError: uninitialized constant Rails
from (irb):2
from /Users/wendi/.rvm/rubies/ruby-2.0.0-p353/bin/irb:12:in '<main>'
>> Bundler.require
=> [<Bundler::Dependency type=:runtime name="rails" requirements="= 4.1.6">, ... ]
>> Rails.version
=> "4.1.6"
>> require_relative 'config/environment.rb'
=> true
|