2016-06-12 94 views
1

我在我的Rails應用程序中使用Sequel而不是Active Record。`require':LoadError:無法加載這樣的文件 - 續集/適配器/ sqlite3(Sequel :: AdapterNotFound)

如何配置它並連接到我的數據庫?目前我使用

DB = Sequel.connect(ENV['DATABASE_URL']) 

,但我得到的錯誤:

/home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:379:in `require': LoadError: cannot load such file -- sequel/adapters/sqlite3 (Sequel::AdapterNotFound) 
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:379:in `block in tsk_require' 
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:100:in `block in check_requiring_thread' 
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:97:in `synchronize' 
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:97:in `check_requiring_thread' 
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:379:in `tsk_require' 
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/database/connecting.rb:25:in `adapter_class' 
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/database/connecting.rb:55:in `connect' 
    from /home/aaditya/Downloads/ruby-bench-suite/rails/vendor/bundle/ruby/2.3.0/gems/sequel-3.40.0/lib/sequel/core.rb:147:in `connect' 
    from benchmarks/bm_sequel_create_string_columns.rb:4:in `<main>' 

當我把我ENV['DATABASE_URL']得到以下輸出:

sqlite3::memory: 

什麼是正確的方法是什麼?

回答

1

當使用Sequel寶石時,該適配器被稱爲sqlite,而不是sqlite3

+0

謝謝你,工作! –

相關問題