2015-09-04 115 views
1

我有我的Gemfile中的sqlite3宝石。运行“软件包安装”可正常运行。问题与sqlite3宝石同时使用红宝石,sinatra&耙

rake db:create_migration NAME=create_messages 

我得到以下错误:当使用耙运行dababase迁移

rake aborted! 
LoadError: Could not load 'active_record/connection_adapters/sqlite_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. 

我甚至尝试指定sqlite3的有1.3.3,然后与1.3.4版本中的Gemfile但是,这并没有解决问题。 Ruby的版本是1.9.3

下面是我的environments.rb文件:

configure :development do 
set :database, 'sqlite:///dev.db' 
set :show_exceptions, true 
end 

以下是从的Gemfile:

source 'https://rubygems.org' 
#ruby "1.9.3" 

gem "sinatra" 
gem "activerecord" 
gem "sinatra-activerecord" 
gem 'sinatra-flash' 
gem 'sinatra-redirect-with-flash' 

group :development do 
gem 'sqlite3-ruby' 
gem "tux" 
end 

我也试图在地方的sqlite3 - 红宝石,但sqlite3的这并没有解决问题。

+0

显示你的database.config。我认为你使用'sqlite'适配器而不是'sqlite3'。 哦,显示你的“设置:数据库” –

+0

@IgorPavlov - 我试图更新我的文章 - 任何想法?谢谢 – user3813256

回答

2

试试这个!

set :database, 'sqlite3:///dev.db' 
+0

我早些时候尝试过 - 我不认为它有效。我现在正在更新ruby版本和其他一切 – user3813256

0

在升级到ruby v2.2.1并重新更新所有gem后,它被重新设置了。我通过RVM安装了v2.2.1。