我的Gemfile中有sqlite3 gem。运行“捆绑安装”可正常运行。使用Rake运行dababase迁移时:
rake db:create_migration NAME=create_messages
我收到以下错误:
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.
我什至尝试在Gemfile中使用1.3.3和1.3.4版本指定sqlite3,但这不能解决问题。 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-ruby,但是并不能解决问题。
最佳答案
试试这个!
set :database, 'sqlite3:///dev.db'
关于ruby - 使用ruby,sinatra和Rake时sqlite3 gem的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32395580/