ActiveRecord声明没有指定适配器

时间:2010-02-26 01:02:09

标签: ruby activerecord macos irb

当我尝试运行以下内容时,我从ActiveRecord收到一条错误,指出找不到连接器。

require 'activerecord'
ActiveRecord::Base.establish_connection(
    :adaptor => "sqlite3", 
    :database => "db.sqlite3"
)

错误讯息:

>> ActiveRecord::Base.establish_connection("adaptor" => "sqlite3-ruby")
ActiveRecord::AdapterNotSpecified: database configuration does not specify 
    adapter from
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/
gems/activerecord/2.2.2/lib/active_record/connection_adapters/abstract/
connection_specification.rb:64:in `establish_connection'

ActiveRecord gem是否已损坏,或者初始代码是否错误?

1 个答案:

答案 0 :(得分:2)

您的参数中看起来像拼写错误的“适配器”。 -er和-or都是正确的英文,但AR是否期望特定的?根据错误消息判断,他们想要-er。