ActiveRecord 声明未指定适配器
当我尝试运行以下命令时,我从 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 是否已损坏,或者初始代码是否不正确?
When I try to run the following, I get an error back from ActiveRecord stating that the connector hasn't been found.
require 'activerecord'
ActiveRecord::Base.establish_connection(
:adaptor => "sqlite3",
:database => "db.sqlite3"
)
Error Message:
>> 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'
Is the ActiveRecord gem broken, or is the initial code incorrect?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您在论证中拼错了“适配器”。 -er 和 -or 在英语中都是正确的,但 AR 是否需要一个特定的?从错误消息来看,他们想要 -er。
Looks like you misspelled "adapter" in your arguments. -er and -or are both proper in English, but does AR expect a specific one? Judging by the error message, they want -er.