我试图在Heroku 上使用带Ruby on Rails的postgresql但是出错了
Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.
我是Rails的新手.此应用程序在我的本地计算机上正常工作,并且没有任何问题地部署.但是当我跑步时heroku run rake db:migrate
,我收到了这个错误:
Running `rake db:migrate` attached to terminal... up, run.1269
rake aborted!
Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile.
Run Code Online (Sandbox Code Playgroud) 在database.yml
(rails生成的默认文件)中:
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
Run Code Online (Sandbox Code Playgroud)
运行时rake about
,我有这个错误:
Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded.
Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by
ActiveRecord).
Run Code Online (Sandbox Code Playgroud)
如果我添加pg
gem,则rake about
提供此输出:
About your application's environment
Ruby version 2.1.0-p0 (x86_64-darwin13.0)
RubyGems version 2.2.2
Rack version 1.5
Rails …
Run Code Online (Sandbox Code Playgroud)