2017-06-17 41 views
11

我無法在Google上找到此警告,因此詢問了Stackowerflower的幫助。使用Postgres安裝最新版本的Rails 4 - 已棄用PGconn,PGresult和PGError常量

我想在新鮮的Centos 7盒子上安裝Rails 4.2.8。 PostgreSQL版本是9.2.18。 Ruby版本是2.3.4。

當安裝Rails時,我像往常一樣配置config/database.yml文件,並確信database.yml文件可以成功連接到數據庫。 Postgres已成功運行其他應用程序,併爲此應用程序創建新角色。

在接下來的步驟有一個實際的問題:

[[email protected] dir]$ rake db:setup 
The PGconn, PGresult, and PGError constants are deprecated, and will be 
removed as of version 1.0. 

You should use PG::Connection, PG::Result, and PG::Error instead, respectively. 

Called from /home/user/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' 
/home/rent/apps/rent/db/schema.rb doesn't exist yet. Run `rake db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /home/user/apps/rent/config/application.rb to limit the frameworks that will be loaded. 
[[email protected] dir]$ 

這是證實了Rails的成功連接到Postgres的?如何簡單檢查它?

如果是 - 我能在Rails 4.2.8中使用類似的Postgres版本多久?

有趣的是,我沒有得到類似的消息與非常類似的設置,所以我想確保我能夠很好地使用此設置。

非常感謝

回答

22

從第0.20.0升級到第0.21.0當我發現同樣的廢棄警告。我似乎沒有任何實際問題,我的應用程序(開發,分期和生產)似乎都工作正常。

但是,我發現警告令人討厭,所以我鎖定了所有的Gemfiles在頁面0.20.0。

+5

將'gem'pg','〜> 0.20.0''添加到'Gemfile'並且消除了此警告。本來,Rails試圖使用0.21.0 –

+0

謝謝。現在它工作正常。 –

+1

可惜這不會被backported到rails 4.x – mb21

相關問題