ActiveRecord Claims No Adaptor Specified
-
22-09-2019 - |
Question
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?
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow