0

私は Heroku でホストされている Hacker News のクローンを持っていました。それをクローンして変更を加え、投票数だけでなく日付でも投票をソートできるようにしました。それはうまくいき、rspec でテストして、すべてグリーンであることを確認しました。最後に、Heroku にプッシュしましたが、エラーも報告されずにうまくいきました。

しかし、そのURLにアクセスすると、「申し訳ありませんが、問題が発生しました。」と表示されます。通常、トラブルシューティングを行いますが、展開または rspec にメッセージがないため、どうすればよいかわかりません。誰かがこれに遭遇した場合、または私が試してみることを提案できる場合は、感謝します。rspec を実行してデプロイした後のターミナル出力は次のとおりです。

Finished in 0.60271 seconds
11 examples, 0 failures

Randomized with seed 33033

jasonrodriguez:infinite-castle-2099 jasonrodriguez$ git add . -A
jasonrodriguez:infinite-castle-2099 jasonrodriguez$ git commit -m "verifying that this app is committed"
# On branch master
nothing to commit, working directory clean
jasonrodriguez:infinite-castle-2099 jasonrodriguez$ git push heroku master
Everything up-to-date
jasonrodriguez:infinite-castle-2099 jasonrodriguez$ 

マスターブランチからこれを行いましたjasonrodriguez:infinite-castle-2099 jasonrodriguez$ git branch * master

私が走ったheroku logs --tailところ、これが得られました:

jasonrodriguez:infinite-castle-2099 jasonrodriguez$ heroku logs --tail
2013-10-19T17:03:32.558564+00:00 app[web.1]: LINE 1: ...8695' AND '2013-10-19 17:03:32.548861')  ORDER BY votes_coun...
2013-10-19T17:03:32.558717+00:00 app[web.1]:     10:   </thead>
2013-10-19T17:03:32.558717+00:00 app[web.1]:     12:     <% Link.most_voted.each do |link| %>
2013-10-19T17:03:32.558717+00:00 app[web.1]:      9:     </tr>
2013-10-19T17:03:32.558717+00:00 app[web.1]: 
2013-10-19T17:03:33.819411+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=infinite-castle-2099.herokuapp.com fwd="67.170.184.10" dyno=web.1 connect=1ms service=11ms status=200 bytes=0
2013-10-19T17:24:26.167584+00:00 app[web.1]: PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:24:26.163272+00:00 app[web.1]: Started GET "/" for 67.170.184.10 at 2013-10-19 17:24:26 +0000
2013-10-19T17:24:26.163272+00:00 app[web.1]: Started GET "/" for 67.170.184.10 at 2013-10-19 17:24:26 +0000
2013-10-19T17:24:26.167584+00:00 app[web.1]:                                                              ^
2013-10-19T17:24:26.167584+00:00 app[web.1]: LINE 1: ...4736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_coun...
2013-10-19T17:24:26.167584+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:24:26.164736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_count DESC LIMIT 100
2013-10-19T17:24:26.167584+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:24:26.164736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_count DESC LIMIT 100
2013-10-19T17:24:26.167584+00:00 app[web.1]: PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:24:26.167584+00:00 app[web.1]:                                                              ^
2013-10-19T17:24:26.168406+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2013-10-19T17:24:26.170324+00:00 app[web.1]: 
2013-10-19T17:24:26.170324+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:24:26.175677+00:00 heroku[router]: at=info method=GET path=/ host=infinite-castle-2099.herokuapp.com fwd="67.170.184.10" dyno=web.1 connect=2ms service=13ms status=500 bytes=1266
2013-10-19T17:24:26.164068+00:00 app[web.1]: Processing by LinksController#index as HTML
2013-10-19T17:24:26.164068+00:00 app[web.1]: Processing by LinksController#index as HTML
2013-10-19T17:24:26.170324+00:00 app[web.1]:     11:   <tbody class="stories">
2013-10-19T17:24:26.170324+00:00 app[web.1]:                                                              ^
2013-10-19T17:24:26.170324+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:24:26.164736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_count DESC LIMIT 100):
2013-10-19T17:24:26.170479+00:00 app[web.1]:     15:                    <%= f.submit  '▲' %>
2013-10-19T17:24:26.170479+00:00 app[web.1]: 
2013-10-19T17:24:26.168250+00:00 app[web.1]:   Rendered links/index.html.erb within layouts/application (3.6ms)
2013-10-19T17:24:26.170479+00:00 app[web.1]:   app/views/links/index.html.erb:12:in `_app_views_links_index_html_erb___4309851234159801657_70037839513200'
2013-10-19T17:24:26.170626+00:00 app[web.1]:     13:           <%= form_for link.votes.new do |f| %>
2013-10-19T17:24:26.170324+00:00 app[web.1]:     13:           <%= form_for link.votes.new do |f| %>
2013-10-19T17:24:26.170479+00:00 app[web.1]: LINE 1: ...4736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_coun...
2013-10-19T17:24:26.170626+00:00 app[web.1]:     12:     <% Link.most_voted.each do |link| %>
2013-10-19T17:24:26.170324+00:00 app[web.1]:      9:     </tr>
2013-10-19T17:24:26.170479+00:00 app[web.1]:                                                              ^
2013-10-19T17:24:26.170626+00:00 app[web.1]:   app/views/links/index.html.erb:12:in `_app_views_links_index_html_erb___4309851234159801657_70037839513200'
2013-10-19T17:24:26.170626+00:00 app[web.1]:      9:     </tr>
2013-10-19T17:24:26.170479+00:00 app[web.1]:     14:                    <%= f.hidden_field :link_id %>
2013-10-19T17:24:26.170626+00:00 app[web.1]:     11:   <tbody class="stories">
2013-10-19T17:24:26.170626+00:00 app[web.1]:     10:   </thead>
2013-10-19T17:24:26.167584+00:00 app[web.1]: LINE 1: ...4736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_coun...
2013-10-19T17:24:26.168489+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2013-10-19T17:24:26.170324+00:00 app[web.1]: LINE 1: ...4736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_coun...
2013-10-19T17:24:26.170479+00:00 app[web.1]: 
2013-10-19T17:24:26.170479+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:24:26.170626+00:00 app[web.1]:     15:                    <%= f.submit  '▲' %>
2013-10-19T17:24:26.168250+00:00 app[web.1]:   Rendered links/index.html.erb within layouts/application (3.6ms)
2013-10-19T17:24:26.170324+00:00 app[web.1]:     10:   </thead>
2013-10-19T17:24:26.170479+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:24:26.164736' AND '2013-10-19 17:24:26.164831')  ORDER BY votes_count DESC LIMIT 100):
2013-10-19T17:24:26.170324+00:00 app[web.1]:     12:     <% Link.most_voted.each do |link| %>
2013-10-19T17:24:26.170479+00:00 app[web.1]: 
2013-10-19T17:24:26.170626+00:00 app[web.1]:     14:                    <%= f.hidden_field :link_id %>
2013-10-19T17:24:26.170626+00:00 app[web.1]: 
2013-10-19T17:24:26.170626+00:00 app[web.1]: 
2013-10-19T17:25:15.524381+00:00 app[web.1]: Started GET "/" for 99.90.16.79 at 2013-10-19 17:25:15 +0000
2013-10-19T17:25:15.529687+00:00 app[web.1]:   Rendered links/index.html.erb within layouts/application (3.8ms)
2013-10-19T17:25:15.529083+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:25:15.525998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_count DESC LIMIT 100
2013-10-19T17:25:15.524381+00:00 app[web.1]: Started GET "/" for 99.90.16.79 at 2013-10-19 17:25:15 +0000
2013-10-19T17:25:15.525289+00:00 app[web.1]: Processing by LinksController#index as HTML
2013-10-19T17:25:15.529083+00:00 app[web.1]: PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:25:15.525289+00:00 app[web.1]: Processing by LinksController#index as HTML
2013-10-19T17:25:15.531524+00:00 app[web.1]:                                                              ^
2013-10-19T17:25:15.531695+00:00 app[web.1]: 
2013-10-19T17:25:15.529083+00:00 app[web.1]:                                                              ^
2013-10-19T17:25:15.529083+00:00 app[web.1]: PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:25:15.529083+00:00 app[web.1]: LINE 1: ...5998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_coun...
2013-10-19T17:25:15.529083+00:00 app[web.1]: LINE 1: ...5998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_coun...
2013-10-19T17:25:15.529083+00:00 app[web.1]:                                                              ^
2013-10-19T17:25:15.531695+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:25:15.525998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_count DESC LIMIT 100):
2013-10-19T17:25:15.529798+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2013-10-19T17:25:15.531841+00:00 app[web.1]:     10:   </thead>
2013-10-19T17:25:15.531841+00:00 app[web.1]:      9:     </tr>
2013-10-19T17:25:15.531841+00:00 app[web.1]: 
2013-10-19T17:25:15.531841+00:00 app[web.1]: 
2013-10-19T17:25:15.529687+00:00 app[web.1]:   Rendered links/index.html.erb within layouts/application (3.8ms)
2013-10-19T17:25:15.529083+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:25:15.525998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_count DESC LIMIT 100
2013-10-19T17:25:15.531841+00:00 app[web.1]:     11:   <tbody class="stories">
2013-10-19T17:25:15.531524+00:00 app[web.1]: : SELECT  "links".* FROM "links"  WHERE ("links"."created_at" BETWEEN '2013-10-12 17:25:15.525998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_count DESC LIMIT 100):
2013-10-19T17:25:15.529798+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2013-10-19T17:25:15.531524+00:00 app[web.1]:     11:   <tbody class="stories">
2013-10-19T17:25:15.531524+00:00 app[web.1]: LINE 1: ...5998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_coun...
2013-10-19T17:25:15.531524+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:25:15.531524+00:00 app[web.1]:     10:   </thead>
2013-10-19T17:25:15.531695+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedColumn: ERROR:  column "votes_count" does not exist
2013-10-19T17:25:15.531695+00:00 app[web.1]: LINE 1: ...5998' AND '2013-10-19 17:25:15.526107')  ORDER BY votes_coun...
2013-10-19T17:25:15.531524+00:00 app[web.1]: 
2013-10-19T17:25:15.531524+00:00 app[web.1]:     12:     <% Link.most_voted.each do |link| %>
2013-10-19T17:25:15.531841+00:00 app[web.1]:   app/views/links/index.html.erb:12:in `_app_views_links_index_html_erb___4309851234159801657_70037839513200'
2013-10-19T17:25:15.531695+00:00 app[web.1]:     14:                    <%= f.hidden_field :link_id %>
2013-10-19T17:25:15.531524+00:00 app[web.1]:     13:           <%= form_for link.votes.new do |f| %>
2013-10-19T17:25:15.531695+00:00 app[web.1]: 
2013-10-19T17:25:15.531695+00:00 app[web.1]:     15:                    <%= f.submit  '▲' %>
2013-10-19T17:25:15.531841+00:00 app[web.1]:     12:     <% Link.most_voted.each do |link| %>
2013-10-19T17:25:15.531695+00:00 app[web.1]:   app/views/links/index.html.erb:12:in `_app_views_links_index_html_erb___4309851234159801657_70037839513200'
2013-10-19T17:25:15.531841+00:00 app[web.1]:     13:           <%= form_for link.votes.new do |f| %>
2013-10-19T17:25:15.531524+00:00 app[web.1]:      9:     </tr>
2013-10-19T17:25:15.531695+00:00 app[web.1]: 
2013-10-19T17:25:15.531841+00:00 app[web.1]:     15:                    <%= f.submit  '▲' %>
2013-10-19T17:25:15.531695+00:00 app[web.1]:                                                              ^
2013-10-19T17:25:15.531841+00:00 app[web.1]:     14:                    <%= f.hidden_field :link_id %>
2013-10-19T17:25:16.054820+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=infinite-castle-2099.herokuapp.com fwd="99.90.16.79" dyno=web.1 connect=2ms service=10ms status=200 bytes=0
2013-10-19T17:25:15.537591+00:00 heroku[router]: at=info method=GET path=/ host=infinite-castle-2099.herokuapp.com fwd="99.90.16.79" dyno=web.1 connect=2ms service=14ms status=500 bytes=1266

votes_countどうやら、私の schema.rb にあるのに見つからないと言われています:

  create_table "links", force: true do |t|
    t.string   "description"
    t.string   "url"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "user_id"
    t.integer  "votes_count"
  end
4

1 に答える 1

1

しかし、そのURLにアクセスすると、「申し訳ありませんが、問題が発生しました」と表示されます。

端末で実行します

heroku logs --tail

ログを分析するには、ページを更新して最新のログを表示することもできます。エラーを見つけてここに貼り付けてください。さらにサポートさせていただきます。

編集

heroku で移行を実行してみてください

heroku run rake db:migrate
于 2013-10-19T17:23:57.873 に答える