Rails应用程序在开发过程中工作正常,但在Heroku postgres导致麻烦

问题描述:

我有一个完美的Rails应用程序在开发和测试。在heroku上部署时,报告没有问题,但该应用无法正常工作。在浏览器中打开它只会提供:Rails应用程序在开发过程中工作正常,但在Heroku postgres导致麻烦

很抱歉,但出错了。 如果您是应用程序所有者检查日志以获取更多信息“

在日志中我看到了皮克表达其对我的变量/表作品‘国家’虽然我不是太熟悉的含义:

app[web.1]:      pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod 

app[web.1]:     FROM pg_attribute a LEFT JOIN pg_attrdef d 

app[web.1]:    WHERE a.attrelid = '"countries"'::regclass 

app[web.1]:     AND a.attnum > 0 AND NOT a.attisdropped 

app[web.1]:    ORDER BY a.attnum 

app[web.1]: app/controllers/application_controller.rb:15:in `default_or_selected_country' 

app[web.1]: 

heroku[router]: at=info method=GET path="/" host=evening-refuge-96756.herokuapp.com request_id=a240125e-4115-40d4-bfb0-ade1b8c909d6 fwd="178.165.130.180" dyno=web.1 connect=1ms service=204ms status=500 bytes=1714 

我看到我的方法`default_or_selected_country”参与相应的代码是在开发和测试模式没有问题:

def default_or_selected_country 
    session[:country_id] ||= Country.find_by(abbreviation: "AT").id 
    @default_or_selected_country = Country.find(session[:country_id]).name 
end 

当我写这篇并购后矿石类似的pg表达式被记录下来,总是包含“国家”表,并且指向与上述相同的方法。

我的问题在哪里,我该如何解决它?谢谢!

+0

1.如果您没有运行Heroku,请运行迁移。2.重新启动服务器。 – zrl3dx

+0

你确定你有国家表内的数据吗? – Sebin

+0

谢谢,[Sebin](http://*.com/users/1684772/sebin),这正是它! – bobito

事实上,我的应用程序最初需要一些数据播种,因为控制器正在将它拉到填充下拉选择器。本地这是由

rake db:seed 

完成在Heroku它是由

heroku run --app APP rake db:seed 

做简单的使用作为本地一样的seeds.rb书面here