0

如标题所示,我通过简单的rake routes得到此错误。耙子中止! PG :: ConnectionBad:Cloud9尝试运行耙路线时出错

我想在C9中,命令运行的默认环境在生产中,因为这是我的Gemfile设置。

group :production do 
    gem 'pg' 
end 

group :development, :test do 
    # Use sqlite3 as the database for Active Record 
    gem 'sqlite3' 
end 

在我的Linux分区运行完美,所以...我怎么能在开发测试环境中的运行rake routes

+1

尝试'rake routes RAILS_ENV = development'? –

+0

它也看起来像这可能是虚拟机没有互联网连接的结果。有时候这可以通过[重新启动工作区]来解决(https://docs.c9.io/docs/restarting-your-workspace)。 –

回答

0

今天我被困在同一个问题上。在我的情况下,出于某种原因,我的访问数据库的开发证书被删除/删除。现在,当我尝试运行耙路线时,它给了我这个错误。

bundle exec rake routes rake routes 

默认情况下,它以开发模式运行。所以,它采用下发展部分指定凭据的config/database.yml的,这在我的情况下,将无法访问数据库了。

所以我改变了的环境中使用生产凭据

bundle exec rake routes rake routes RAILS_ENV=production 

同样,如果你想使用的开发则是@Van伊的评论,你可以做到这一点建议。

bundle exec rake routes rake routes RAILS_ENV=development 
0

我也有运气运行bundle install --without production这将让这个PG是根本不存在的开发环境。