2016-11-28 4 views
0

私はヒロイックに展開していますが、成功しましたが、ヒロイックなURLに行ったときに500エラーが発生しました。ここに私のログファイルはヒロイック500のエラーですがローカルではありません

2016-11-28T22:19:09.106733+00:00 app[web.1]:  10:  <tbody> 
 
2016-11-28T22:19:09.106735+00:00 app[web.1]:  11:  <% @users.try(:each) do |user| %> 
 
2016-11-28T22:19:09.106736+00:00 app[web.1]:  13:   <td><%= user.first_name + " " + user.last_name %></td> 
 
2016-11-28T22:19:09.106735+00:00 app[web.1]:  12:   <tr> 
 
2016-11-28T22:19:09.106737+00:00 app[web.1]:  14:   <td><%= user.email %></td> 
 
2016-11-28T22:19:09.106737+00:00 app[web.1]:  15:   <td> 
 
2016-11-28T22:19:09.106738+00:00 app[web.1]:  16:    <% if follow = user.follows.find_by(follows: user.id) %> 
 
2016-11-28T22:19:09.106742+00:00 app[web.1]: app/views/follows/index.html.erb:11:in `_app_views_follows_index_html_erb___1812592661839220487_70215972087760' 
 
2016-11-28T22:19:09.106741+00:00 app[web.1]: app/views/follows/index.html.erb:13:in `block in _app_views_follows_index_html_erb___1812592661839220487_70215972087760' 
 
2016-11-28T22:19:09.106742+00:00 app[web.1]: 
 
2016-11-28T22:19:09.106743+00:00 app[web.1]: 
 
2016-11-28T22:24:13.636808+00:00 heroku[router]: at=info method=GET path="/follows" host=sn-sql.herokuapp.com request_id=fb1f9eee-890b-4227-8185-2ada91825cb6 fwd="141.225.80.1" dyno=web.1 connect=0ms service=30ms status=500 bytes=1759 
 
2016-11-28T22:24:13.634688+00:00 app[web.1]: Started GET "/follows" for 141.225.80.1 at 2016-11-28 22:24:13 +0000 
 
2016-11-28T22:24:13.637819+00:00 app[web.1]: Processing by FollowsController#index as HTML 
 
2016-11-28T22:24:13.642862+00:00 app[web.1]: [1m[36mUser Load (0.9ms)[0m [1mSELECT "users".* FROM "users"[0m 
 
2016-11-28T22:24:13.645429+00:00 app[web.1]: Rendered follows/index.html.erb within layouts/application (4.4ms) 
 
2016-11-28T22:24:13.645666+00:00 app[web.1]: Completed 500 Internal Server Error in 8ms (ActiveRecord: 0.9ms) 
 
2016-11-28T22:24:13.647633+00:00 app[web.1]: 
 
2016-11-28T22:24:13.647634+00:00 app[web.1]: ActionView::Template::Error (undefined method `+' for nil:NilClass): 
 
2016-11-28T22:24:13.647635+00:00 app[web.1]:  10:  <tbody> 
 
2016-11-28T22:24:13.647636+00:00 app[web.1]:  11:  <% @users.try(:each) do |user| %> 
 
2016-11-28T22:24:13.647637+00:00 app[web.1]:  12:   <tr> 
 
2016-11-28T22:24:13.647637+00:00 app[web.1]:  13:   <td><%= user.first_name + " " + user.last_name %></td> 
 
2016-11-28T22:24:13.647638+00:00 app[web.1]:  14:   <td><%= user.email %></td> 
 
2016-11-28T22:24:13.647639+00:00 app[web.1]:  15:   <td> 
 
2016-11-28T22:24:13.647639+00:00 app[web.1]:  16:    <% if follow = user.follows.find_by(follows: user.id) %> 
 
2016-11-28T22:24:13.647640+00:00 app[web.1]: app/views/follows/index.html.erb:13:in `block in _app_views_follows_index_html_erb___1812592661839220487_70215972087760' 
 
2016-11-28T22:24:13.647641+00:00 app[web.1]: app/views/follows/index.html.erb:11:in `_app_views_follows_index_html_erb___1812592661839220487_70215972087760' 
 
2016-11-28T22:24:13.647642+00:00 app[web.1]: 
 
2016-11-28T22:24:13.647642+00:00 app[web.1]: 
 
2016-11-28T22:28:05.898802+00:00 app[web.1]: Started HEAD "/" for 54.80.172.253 at 2016-11-28 22:28:05 +0000 
 
2016-11-28T22:28:05.900540+00:00 app[web.1]: Processing by NewsFeedController#index as HTML 
 
2016-11-28T22:28:05.903485+00:00 app[web.1]: Rendered posts/_form.html.erb (1.4ms) 
 
2016-11-28T22:28:05.904672+00:00 app[web.1]: [1m[35mPost Load (0.8ms)[0m SELECT "posts".* FROM "posts" 
 
2016-11-28T22:28:05.907075+00:00 app[web.1]: [1m[36mUser Load (1.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1[0m [["id", 1]] 
 
2016-11-28T22:28:05.913989+00:00 app[web.1]: Rendered posts/_post.html.erb (9.0ms) 
 
2016-11-28T22:28:05.914213+00:00 app[web.1]: Rendered news_feed/index.html.erb within layouts/application (12.3ms) 
 
2016-11-28T22:28:05.914387+00:00 app[web.1]: Completed 500 Internal Server Error in 14ms (ActiveRecord: 1.8ms) 
 
2016-11-28T22:28:05.915476+00:00 app[web.1]: 
 
2016-11-28T22:28:05.915478+00:00 app[web.1]: ActionView::Template::Error (undefined method `id' for nil:NilClass): 
 
2016-11-28T22:28:05.915479+00:00 app[web.1]:  20:    </div> 
 
2016-11-28T22:28:05.915480+00:00 app[web.1]:  21:    <div class="panel-body"> 
 
2016-11-28T22:28:05.915481+00:00 app[web.1]:  22:    <p><%= post.post_text %></p> 
 
2016-11-28T22:28:05.915484+00:00 app[web.1]:  23:    <% if like = post.likes.find_by(user_id: current_user.id) %> 
 
2016-11-28T22:28:05.915485+00:00 app[web.1]:  24:     <%= link_to '<i class="fa fa-thumbs-down" aria-hidden="true"></i> Unlike'.html_safe, like, method: 'delete',class: "" %> 
 
2016-11-28T22:28:05.915486+00:00 app[web.1]:  25:    <% else %> 
 
2016-11-28T22:28:05.915487+00:00 app[web.1]:  26:     <%= link_to '<i class="fa fa-thumbs-up" aria-hidden="true"></i> Like'.html_safe, likes_path({post_id: post.id}), method: 'post',class: "" %> 
 
2016-11-28T22:28:05.915488+00:00 app[web.1]: app/views/posts/_post.html.erb:23:in `_app_views_posts__post_html_erb__2305306643930163929_70215970144600' 
 
2016-11-28T22:28:05.915489+00:00 app[web.1]: app/views/news_feed/index.html.erb:3:in `block in _app_views_news_feed_index_html_erb__1204754539652968054_70215970424660' 
 
2016-11-28T22:28:05.915490+00:00 app[web.1]: app/views/news_feed/index.html.erb:2:in `_app_views_news_feed_index_html_erb__1204754539652968054_70215970424660' 
 
2016-11-28T22:28:05.915491+00:00 app[web.1]: 
 
2016-11-28T22:28:05.915491+00:00 app[web.1]: 
 
2016-11-28T22:28:05.907994+00:00 heroku[router]: at=info method=HEAD path="/" host=sn-sql.herokuapp.com request_id=85b21e2a-cdc7-4bfe-a3b5-8ff1ca1a460e fwd="54.80.172.253" dyno=web.1 connect=0ms service=19ms status=500 bytes=277

ない、それは私のローカルサーバー上で完全に正常に動作するので何が起こっているかを確認してくださいです。これがログの中で何を意味するのかわからない。どんな助けも素晴らしいだろう。

答えて

0

まず、ログアプリケーションの開発を始める場合には、デバッグのために必要な基本事項の1つとして、ログの読み込みに慣れるようにしてください。

彼らはそこにエラーが基本的には明らかに意味がありません何か、それゆえエラーにnilを追加しようとしていると言って、ここで

ActionView::Template::Error (undefined method `+' for nil:NilClass): 

何であるかを教えてくれ記録します。あなたがここにユーザー名と姓

<td><%= user.first_name + " " + user.last_name %></td> 

を追加しようとしている見ることができるの下にあなたがしてブロックを見ればだから、ユーザーがいずれかの姓または名が欠落しています。だから、あなたが必要とするすべてはまた

<% if user.first_name && user.last_name %> 
    <td><%= user.first_name + " " + user.last_name %></td> 

    whatever else... 
<% end %> 

のように、あなたに似た何かを言って、ここで

ActionView::Template::Error (undefined method `id' for nil:NilClass): 

別のエラー、あなたがそれらを追加する前に、両方が存在することを確認することが条件です。私が言ったように、言語に関係なく、開発には独自のコードをデバッグすることが不可欠であるため、エラーがどこから来ているのかを調べてみてください。

関連する問題