我想使用 Sqlite 创建一个新的 Rails 应用程序,但我发现了一些问题。
我正在使用正确安装的 Rails 5.0.7.1
,并且 gem 'sqlite3'
包含在我的 Gemfile 中。我的系统(Mac OS)中的 sqlite3 版本是 3.24.0 2018-06-04 14:10:15 95fbac39baaab1c3a84fdfc82ccb7f42398b2e92f18a2a57bce1d4a713cbaapl
运行 Rails 服务器并访问我的 localhost:3000 给出错误:
Specified 'sqlite3' for database adapter, but the gem is not loaded. Add
gem 'sqlite3'
to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
gem 是运行捆绑安装安装的,我可以在 Gemfile.lock sqlite3 (1.4.0)
不知道是什么问题。有人可以帮助我吗? 谢谢!
最佳答案
我在旧版本的 ruby/rails(2.5/5.2) 上使用 sqlite3(1.4.0) 时遇到问题。您可以尝试在 Gemfile 中指定较低版本的 sqlite3,然后再次运行该 bundle 。
gem 'sqlite3', '~> 1.3.13'
关于ruby-on-rails - 如何在 Mac 上使用 Sqlite3 运行 Rails?我收到 "gem is not loaded"但它包含在 Gemfile 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54615884/