0

所以我的主要导轨模型是“公司”。当我在本地托管我的应用程序并导航到 localhost:3000/companies 时,一切正常。但是当我导航到我的应用程序的 heroku 版本时:

http://calm-journey-2877.herokuapp.com/companies

.. 我收到错误“我们很抱歉,但出了点问题”

这表明该页面存在但正在产生某种错误。知道会发生什么吗?这是我通过阅读 Rails 教程书构建的一个非常基本的应用程序。

谢谢!!

编辑:

这是 Heroku 日志。

2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:38:in `receive_data'
2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/backends/base.rb:63:in `start'
2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/server.rb:159:in `start'
2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/runner.rb:185:in `run_command'
2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/controllers/controller.rb:86:in `start'
2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/runner.rb:151:in `run!'
2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/bin/thin:19:in `load'
2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/bin/thin:19:in `<main>'
2012-08-29T22:20:54+00:00 app[web.1]: 
2012-08-29T22:20:54+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/bin/thin:6:in `<top (required)>'
2012-08-29T22:20:54+00:00 app[web.1]: 
2012-08-29T22:20:54+00:00 heroku[router]: GET calm-journey-2877.herokuapp.com/clients dyno=web.1 queue=0 wait=0ms service=7ms status=404 bytes=728
2012-08-29T22:21:00+00:00 app[web.1]: 
2012-08-29T22:21:00+00:00 app[web.1]: 
2012-08-29T22:21:00+00:00 app[web.1]: Started GET "/companies" for 24.14.103.65 at 2012-08-29 22:21:00 +0000
2012-08-29T22:21:00+00:00 app[web.1]: Processing by CompaniesController#index as HTML
2012-08-29T22:21:00+00:00 app[web.1]: Completed 500 Internal Server Error in 7ms
2012-08-29T22:21:00+00:00 app[web.1]: 
2012-08-29T22:21:00+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR:  relation "companies" does not exist
2012-08-29T22:21:00+00:00 app[web.1]: LINE 4:              WHERE a.attrelid = '"companies"'::regclass
2012-08-29T22:21:00+00:00 app[web.1]:                                         ^
2012-08-29T22:21:00+00:00 app[web.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
2012-08-29T22:21:00+00:00 app[web.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2012-08-29T22:21:00+00:00 app[web.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2012-08-29T22:21:00+00:00 app[web.1]:              WHERE a.attrelid = '"companies"'::regclass
2012-08-29T22:21:00+00:00 app[web.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2012-08-29T22:21:00+00:00 app[web.1]:              ORDER BY a.attnum
2012-08-29T22:21:00+00:00 app[web.1]: ):
2012-08-29T22:21:00+00:00 app[web.1]:   app/controllers/companies_controller.rb:86:in `sort_column'
2012-08-29T22:21:00+00:00 app[web.1]:   app/controllers/companies_controller.rb:6:in `index'
2012-08-29T22:21:00+00:00 app[web.1]: 
2012-08-29T22:21:00+00:00 app[web.1]: 
2012-08-29T22:21:00+00:00 heroku[router]: GET calm-journey-2877.herokuapp.com/companies dyno=web.1 queue=0 wait=0ms service=13ms status=500 bytes=643
2012-08-29T22:21:00+00:00 heroku[router]: GET calm-journey-2877.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=3ms status=304 bytes=0
2012-08-29T22:27:31+00:00 app[web.1]: 
2012-08-29T22:27:31+00:00 app[web.1]: 
2012-08-29T22:27:31+00:00 app[web.1]: Started GET "/companies" for 24.14.103.65 at 2012-08-29 22:27:31 +0000
2012-08-29T22:27:31+00:00 app[web.1]: Processing by CompaniesController#index as HTML
2012-08-29T22:27:31+00:00 app[web.1]: Completed 500 Internal Server Error in 14ms
2012-08-29T22:27:31+00:00 app[web.1]: 
2012-08-29T22:27:31+00:00 app[web.1]: LINE 4:              WHERE a.attrelid = '"companies"'::regclass
2012-08-29T22:27:31+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR:  relation "companies" does not exist
2012-08-29T22:27:31+00:00 app[web.1]:                                         ^
2012-08-29T22:27:31+00:00 app[web.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
2012-08-29T22:27:31+00:00 app[web.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2012-08-29T22:27:31+00:00 app[web.1]:              WHERE a.attrelid = '"companies"'::regclass
2012-08-29T22:27:31+00:00 app[web.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2012-08-29T22:27:31+00:00 app[web.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2012-08-29T22:27:31+00:00 app[web.1]:              ORDER BY a.attnum
2012-08-29T22:27:31+00:00 app[web.1]: ):
2012-08-29T22:27:31+00:00 app[web.1]:   app/controllers/companies_controller.rb:86:in `sort_column'
2012-08-29T22:27:31+00:00 app[web.1]:   app/controllers/companies_controller.rb:6:in `index'
2012-08-29T22:27:31+00:00 app[web.1]: 
2012-08-29T22:27:31+00:00 app[web.1]: 
2012-08-29T22:27:31+00:00 heroku[router]: GET calm-journey-2877.herokuapp.com/companies dyno=web.1 queue=0 wait=0ms service=42ms status=500 bytes=643
2012-08-29T22:27:31+00:00 heroku[router]: GET calm-journey-2877.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=3ms status=304 bytes=0
2012-08-29T22:29:13+00:00 app[web.1]: 
2012-08-29T22:29:13+00:00 app[web.1]: 
2012-08-29T22:29:13+00:00 app[web.1]: Started GET "/companies" for 24.14.103.65 at 2012-08-29 22:29:13 +0000
2012-08-29T22:29:13+00:00 app[web.1]: Processing by CompaniesController#index as HTML
2012-08-29T22:29:13+00:00 app[web.1]: Completed 500 Internal Server Error in 3ms
2012-08-29T22:29:13+00:00 app[web.1]: 
2012-08-29T22:29:13+00:00 app[web.1]: LINE 4:              WHERE a.attrelid = '"companies"'::regclass
2012-08-29T22:29:13+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR:  relation "companies" does not exist
2012-08-29T22:29:13+00:00 app[web.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
2012-08-29T22:29:13+00:00 app[web.1]:                                         ^
2012-08-29T22:29:13+00:00 app[web.1]:              WHERE a.attrelid = '"companies"'::regclass
2012-08-29T22:29:13+00:00 app[web.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2012-08-29T22:29:13+00:00 app[web.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2012-08-29T22:29:13+00:00 app[web.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2012-08-29T22:29:13+00:00 app[web.1]:              ORDER BY a.attnum
2012-08-29T22:29:13+00:00 app[web.1]: ):
2012-08-29T22:29:13+00:00 app[web.1]:   app/controllers/companies_controller.rb:6:in `index'
2012-08-29T22:29:13+00:00 app[web.1]:   app/controllers/companies_controller.rb:86:in `sort_column'
2012-08-29T22:29:13+00:00 app[web.1]: 
2012-08-29T22:29:13+00:00 app[web.1]: 
2012-08-29T22:29:13+00:00 heroku[router]: GET calm-journey-2877.herokuapp.com/companies dyno=web.1 queue=0 wait=0ms service=10ms status=500 bytes=643
2012-08-29T22:33:52+00:00 app[web.1]: 
2012-08-29T22:33:52+00:00 app[web.1]: 
2012-08-29T22:33:52+00:00 app[web.1]: Started GET "/companies" for 186.147.240.150 at 2012-08-29 22:33:52 +0000
2012-08-29T22:33:52+00:00 app[web.1]: Processing by CompaniesController#index as HTML
2012-08-29T22:33:52+00:00 app[web.1]: Completed 500 Internal Server Error in 3ms
2012-08-29T22:33:52+00:00 app[web.1]: 
2012-08-29T22:33:52+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR:  relation "companies" does not exist
2012-08-29T22:33:52+00:00 app[web.1]: LINE 4:              WHERE a.attrelid = '"companies"'::regclass
2012-08-29T22:33:52+00:00 app[web.1]:                                         ^
2012-08-29T22:33:52+00:00 app[web.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2012-08-29T22:33:52+00:00 app[web.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
2012-08-29T22:33:52+00:00 app[web.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2012-08-29T22:33:52+00:00 app[web.1]:              WHERE a.attrelid = '"companies"'::regclass
2012-08-29T22:33:52+00:00 app[web.1]: 
2012-08-29T22:33:52+00:00 app[web.1]:              ORDER BY a.attnum
2012-08-29T22:33:52+00:00 app[web.1]:   app/controllers/companies_controller.rb:86:in `sort_column'
2012-08-29T22:33:52+00:00 app[web.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2012-08-29T22:33:52+00:00 app[web.1]: ):
2012-08-29T22:33:52+00:00 app[web.1]:   app/controllers/companies_controller.rb:6:in `index'
2012-08-29T22:33:52+00:00 app[web.1]: 
2012-08-29T22:33:52+00:00 heroku[router]: GET calm-journey-2877.herokuapp.com/companies dyno=web.1 queue=0 wait=0ms service=10ms status=500 bytes=643
2012-08-29T22:33:52+00:00 heroku[router]: GET calm-journey-2877.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=4ms status=200 bytes=0
4

2 回答 2

1

您是否在 Heroku 中迁移了数据库heroku run rake db:migrate

于 2012-08-29T22:34:43.383 回答
0

您的解决方案在 git 中。编写您的 rake 任务并确保它在您的 git 存储库中。

比尝试 Heroku 运行 rake your_task

或者将您的数据库种子文件用于其预期目的。

于 2012-08-29T22:57:14.607 回答