2012-03-27 69 views
1

Possible Duplicate:
Error loading Active Record gem with sinatra app using RVMrackup無法加載ActiveRecord的

我有一個王菲的應用程序,其中我想使ActiveRecord使用的。我有這個在我的faye.ru:

require "rubygems" 
require "faye" 
require "sqlite3" 
require "activerecord" 

... other code 

而且我想通過啓動它:rackup faye.ru -s thin -E production

這失敗,出現以下錯誤:/home/tempus/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in 'require': cannot load such file -- activerecord (LoadError)。如果我運行rvm current,則得到:[email protected]。如果我做的RVM DIR這個寶石一個LS,我可以看到,ActiveRecord的確實安裝:

actionmailer-3.2.2 builder-3.0.0    hike-1.2.1   polyglot-0.3.3 sprockets-2.1.2 
actionpack-3.2.2  cookiejar-0.3.0   http_parser.rb-0.5.3 rack-1.4.1  sqlite3-1.3.5 
activemodel-3.2.2  em-http-request-1.0.2  i18n-0.6.0   rack-cache-1.2 thor-0.14.6 
activerecord-3.2.2 em-socksify-0.1.0   journey-1.0.3   rack-ssl-1.3.2 tilt-1.3.3 
activeresource-3.2.2 erubis-2.7.0    json-1.6.6   rack-test-0.6.1 treetop-1.4.10 
activesupport-3.2.2 eventmachine-1.0.0.beta.4 mail-2.4.4   rails-3.2.2  tzinfo-0.3.32 
addressable-2.2.7  faye-0.8.1     mime-types-1.18  railties-3.2.2 yajl-ruby-1.1.0 
arel-3.0.2   faye-websocket-0.4.4  multi_json-1.2.0  rdoc-3.12 

我不明白爲什麼它會說,它無法找到的ActiveRecord。任何線索?

回答

13

即使寶石被稱爲activerecord,該類稱爲ActiveRecord,其轉換爲active_record在蛇的情況下:

require 'active_record' 
+0

同樣的問題,用的ActiveSupport和兄弟.. – 2014-03-16 12:08:20

+0

不要忘記後重新啓動服務器改變以避免錯誤持續存在! – fagiani 2017-06-28 15:06:43