使用Postgres安装最新版本的Rails 4 - 不推荐使用PGconn,PGresult和PGError常量

lai*_*son 15 ruby-on-rails postgresql-9.2

我无法在Google上找到此警告,因此请求Stackowerflower的帮助.

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

安装Rails时,我像往常一样配置config/database.yml文件,并且非常确定database.yml文件可以成功连接到DB.Postgres已经成功运行其他应用程序,并为此应用程序创建了新的角色.

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

[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]$
Run Code Online (Sandbox Code Playgroud)

这是否证实Rails成功连接到Postgres?如何简单检查一下?

如果是 - 我可以在Rails 4.2.8中使用类似的Postgres版本多长时间?

有趣的是,我没有得到类似的设置非常相似的消息,所以我想确保我能够很好地使用这个设置.

非常感谢

jvi*_*ian 27

从pg 0.20.0升级到pg 0.21.0时,我注意到了相同的弃用警告.我似乎没有任何实际的问题与pg和我的应用程序(开发,分期和生产)似乎一切正常.

然而,我发现这个警告很烦人,所以我将所有的Gemfiles锁定在0.20.0.

  • 在`Gemfile`中添加了'gem'pg','〜> 0.20.0',并消除了这个警告.最初,Rails试图使用0.21.0 (6认同)