使用Postgres安装最新版本的Rails 4-不推荐使用PGconn,PGresult和PGError常量 [英] Installing newest version of Rails 4 with Postgres - The PGconn, PGresult, and PGError constants are deprecated

查看:201
本文介绍了使用Postgres安装最新版本的Rails 4-不推荐使用PGconn,PGresult和PGError常量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在Google上找到此警告,因此请Stackowerflower提供帮助。

I'm not able to find this warning on Google so asking Stackowerflower's help.

我想在新鲜的Centos 7盒子上安装Rails 4.2.8。
Postgres版本是9.2.18。
Ruby版本为2.3.4。

I want to install Rails 4.2.8 on fresh Centos 7 box. Postgres version is 9.2.18. Ruby version is 2.3.4.

在安装Rails后,我像往常一样配置config / database.yml文件,并确定database.yml文件正常成功连接到数据库。 Postgres已经在其他应用程序上成功运行,并且为此应用程序创建了新角色。

When Rails is installed I configure config/database.yml file as usual and pretty sure that database.yml file is ok to connect to DB successfully. Postgres is already running for other apps successfully and fresh role is created for this app.

下一步中存在一个实际问题:

In the next step there is an actual issue:

[user@server 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.
[user@server dir]$

这是否确认Rails已成功连接到Postgres?

Is this confirms that Rails successfully connected to Postgres? How to simply check it?

如果是,我可以在Rails 4.2.8中使用类似的Postgres版本多久?

If yes - how long will I be able to use similar Postgres versions with Rails 4.2.8?

有趣的是我在设置非常相似的情况下没有收到类似的消息,所以我想确保自己能够很好地使用此设置。

Interesting thing that I didn't get similar messages with very similar setup so I wanted to be sure that I will be able to use this setup well.

非常感谢

推荐答案

从pg 0.20.0升级到pg 0.21.0时,我注意到了同样的弃用警告。我对pg似乎没有任何实际问题,我的应用程序(开发,暂存和生产)似乎都可以正常工作。

I noticed the same deprecation warnings when upgrading from pg 0.20.0 to pg 0.21.0. I didn't seem to have any actual problems with pg and my apps (dev, staging, and production) all seemed to work fine.

但是我发现警告很烦人,所以我将所有Gemfile锁定在pg 0.20.0。

I found the warning annoying, however, so I locked all my Gemfiles at pg 0.20.0.

这篇关于使用Postgres安装最新版本的Rails 4-不推荐使用PGconn,PGresult和PGError常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆