我正在学习 rails,当我开始并安装基于我正在阅读的书籍的 sqlite3 的所有内容时。但是,我正在尝试部署我在 heroku 上编写的测试应用程序。Heroku 建议应用程序运行 postgresql 进行开发和生产,以防止出现细微的错误。所以我决定从今以后对我所有的 Rails 应用程序使用 post gresql。
为此,我进行了以下设置:
1)下载并安装了 Postgresql
2)在我的 .bash_rc 文件中添加了文件夹的路径
3)安装了 pg gem
4)到目前为止一切都很好。但是,当我转到我的应用程序的根文件夹并尝试以下命令时:
rails generate scaffold User name:string email:string
我在控制台上收到以下错误
rails generate scaffold User name:string email:string
invoke active_record
/Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/bundler-
1.0.22/lib/bundler/rubygems_integration.rb:143:in `block in replace_gem':
Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter`
(sqlite3 is not part of the bundle. Add it to Gemfile.) (LoadError)
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-
3.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:3:in `<top (required)>'
这告诉我,我的 rails 应用程序中的默认设置清楚地适用于 sqlite3。所以我打开了我的 databse.yml 文件,这就是它的内容。
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
一切都为 sqlite3 设置了如何更改我的 rails 设置,以便默认情况下数据库的所有配置都用于 postgresql?
谢谢