[Rails3] uninitialized constant Object::Bundler


CentOSにRails3&Passengerを入れてる途中で結構はまる。
Rails2に馴れてるせいかRails3があまり親切な感じがしないな。

$rake db:create
(in /price)
rake aborted!
uninitialized constant Object::Bundler
/usr/local/lib/ruby/1.9.1/rake.rb:2482:in `const_missing’
/config/boot.rb:9:in `rescue in
/config/boot.rb:5:in `
:29:in `require’
:29:in `require’
config/application.rb:1:in `
:29:in `require’
:29:in `require’
/Rakefile:4:in `
/usr/local/lib/ruby/1.9.1/rake.rb:2373:in `load’
/usr/local/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile’
/usr/local/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile’
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling’
/usr/local/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile’
/usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run’
/usr/local/bin/rake:31:in `

以下、解決方法 (赤色文字を追加する)
vim config/boot.rb

require ‘rubygems’
gem ‘bundler’
# Set up gems listed in the Gemfile.
gemfile = File.expand_path(‘../../Gemfile’, __FILE__)
begin
ENV[‘BUNDLE_GEMFILE’] = gemfile
require ‘bundler’
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts “Try running `bundle install`.”
exit!
end if File.exist?(gemfile)