2012-03-31 49 views
0

對不起,我是Ruby on Rails中的新成員,我正在學習一個教程,但我遇到了麻煩,試圖將數據庫推送到heroku。我已經在我的Linux中安裝了postgresql,嘗試了很多教程。Rails- Heroku - 耙子中止了!請安裝postgresql適配器:gem install activerecord-postgresql-adapter

當我進入heroku rake db:migrate,我收到此錯誤信息:

DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these >plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or >fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the >release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2- >has-been-released. (called from at /app/Rakefile:7) rake aborted! Please install the postgresql adapter: gem install activerecord-postgresql-adapter (pg is >not part of the bundle. Add it to Gemfile.)

Tasks: TOP => db:migrate => db:load_config (See full trace by running task with --trace)

我的Gemfile是這樣的:

source 'https://rubygems.org' 
gem 'rails', '3.2.2' 
gem 'sqlite3' 

group :production do 
    gem 'pg' 
end 

group :assets do 
gem 'sass-rails', '~> 3.2.3' 
gem 'coffee-rails', '~> 3.2.1' 

gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

回答

3

正如提到的錯誤,你需要安裝PostgreSQL的適配器

Please install the postgresql adapter: gem install activerecord-postgresql-adapter (pg is >not part of the bundle. Add it to Gemfile.) 

使用gem install activerecord-postgresql-adapter進行安裝。您還應該將gem 'pg'添加到您的Gemfile並運行bundle install


如前所述here,看看你的database.yml文件來檢查,如果你寫了「Postgres的」,而不是「PostgreSQL的」。

+0

我試着已經是這樣說:錯誤:無法找到有效的寶石的ActiveRecord-PostgreSQL的適配器「(> = 0)中的任何存儲庫 錯誤:可能的選擇:ActiveRecord的-jdbcpostgresql適配器,ActiveRecord的-PostGIS的適配器,activerecord-jdbcmssql-adapter,activerecord-jdbcmysql-adapter,activerecord-postgresql-cursors – Aklovo 2012-03-31 03:36:04

+0

我更新了我的答案。我把解決方案放在線下。 – 2012-03-31 12:56:14

+0

這個解決方案在這裏看起來不錯,如果你仍然有這個問題,你可以用你的「gem list」輸出和你的Gemfile.lock來更新它嗎?還要確保你已經使用了bundle安裝。 – YogiZoli 2012-04-03 00:39:18

1

我也得到了這個錯誤(在2015年不會少),並追蹤到*咳嗽*沒有把我最近的更改database.yml文件暫存到我的git倉庫中。

新人的錯誤,我想。現在

git commit -am 'added yaml production strings' 
git push heroku master 

,我我其實送我以爲我發送文件,我不再得到gem install activerecord-postgresql-adapter消息。

我已成功地避免這兩個混帳 Heroku上相當長的一段時間 - 年,真的 - 而這些小打嗝的時刻到來厚,快速。我似乎花費了大部分時間來研究實際發生的事情,以及我認爲正在發生的事情。

相關問題