2012-09-03 81 views
0

我已經安裝了我在How to handle Ruby on Rails error: "Please install the postgresql adapter: `gem install activerecord-postgresql-adapter'"中列出的所有寶石 - 它們都不起作用。不要緊,如果我在我的databases.yml文件中有postgres或postgresql。嘗試運行服務器時Ruby on Rails postgres適配器錯誤

我不知道我在做什麼錯了(我也裝在錯誤中提到的驅動程序也是如此。我不斷收到這個錯誤。

/var/lib/gems/1.8/gems/bundler-1.1.5/lib/bundler/rubygems_integration.rb:147:in `gem': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) 

我試圖運行「軌道服務器的WEBrick -p 80 -e生產的」

production: 
    adapter: postgresql 
    encoding: unicode 
    database: imentor 
    pool: 5 
    username: postgres 
    password: 
    host: localhost 
    port: 5432 

我的問題是,我不知道該往哪兒編輯的Gemfile((看了看錯誤的寶石文件原本)

將「gem'pg'」添加到Gemfile中修復它。由於'畝太短'

+1

在你的Gemfile什麼? –

+0

我在/ usr/bin/gem中添加了我的內容(不是100%確定是否這是正確的 - 我還添加了'pg') – StanM

+2

您應該在您的根目錄下有一個名爲'Gemfile'的文件Rails應用程序。 –

回答

1

我的問題是,我不知道該往哪兒編輯的Gemfile(看着原本是錯誤的寶石文件)

加入「寶石‘PG’」到Gemfile中固定它。 感謝「畝太短」

0

幾周前我遇到了這樣的問題。我想你應該首先嚐試將這段代碼添加到boot.rb文件中。

require 'yaml' 
YAML::ENGINE.yamler = 'syck' 

你也應該嘗試addding這給grmfile並運行一個安裝包後立即

gem 'pg' 

如果它也能幫助這是我的database.yml文件的樣本。希望它有效!

production: 
    adapter: postgresql 
    encoding: unicode 
    database: dezirus 
    username: postgres 
    password: 
+0

它不會抱怨不能解析或與yaml有關嗎?這也是一切的全新安裝,所以遺留代碼不會有任何問題(我認爲這是yaml問題可能出現的地方) – StanM

1

在Ubuntu我只是做

apt-get install libpgsql-ruby 
相關問題