即使它在我的宝石列表上也不能要求ar gem

时间:2014-02-28 22:57:47

标签: ruby activerecord gem

当我输入

gem list

我看到以下

...
activerecord (3.2.17, 3.2.13)
...

但是当我输入这个

cat >> does_ar_exist.rb
require 'activerecord'
ActiveRecord

ruby does_ar_exist.rb

我收到以下错误:

/Users/xxxxxx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:51:in `require': cannot load such file -- activerecord (LoadError)
from /Users/xxxxxx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:51:in `require'

有谁知道为什么会这样?

1 个答案:

答案 0 :(得分:1)

你必须这样做:

require 'active_record'

而不是require 'activerecord',因为您要加载的文件是active_record.rb