質問編集履歴

6

情報の追加

2019/01/10 06:19

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  エラーメッセージの最後にredirect_to(...) and returnとあるのですが、このアクション内にはredirect_toもrenderもないため、別のところに問題があると推測しています。
4
4
 
5
- おそらくサーバーが立ち上がらなくなってから復旧した際の処理の何かが引っかかっのだと思います。
5
+ サーバーが立ち上がらなくなったことがあり、それを復旧した際の処理の何かがおそらく引っかかっているのだと思います。
6
6
 
7
7
 
8
8
 

5

情報追加

2019/01/10 06:19

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -198,6 +198,26 @@
198
198
 
199
199
 
200
200
 
201
+ また、application_controller.rbのhandle_505内の
202
+
203
+ ```ruby
204
+
205
+ return render template: 'errors/error_500', status: 500, layout: false, content_type:
206
+
207
+ ```
208
+
209
+ の一行を
210
+
211
+ ```ruby
212
+
213
+ render template: 'errors/error_500', status: 500, layout: false, content_type: and return
214
+
215
+ ```
216
+
217
+ と変えてみましたがエラーメッセージに変化はありませんでした。
218
+
219
+
220
+
201
221
  ## 実現したいこと
202
222
 
203
223
 

4

情報修正

2019/01/10 06:13

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
  staging.logでログを確認すると、
82
82
 
83
- logger.debug("ggggggggggggggggggggggggggggggggg")までは問題ないようですが、logger.debug("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")がなく、DownloadLog.create(user_id: current_user.id, product_id: @product.id)の部分でエラーが起きているようです。
83
+ logger.debug("ggggggggggggggggggggggggggggggggg")までは問題ないようですが、logger.debug("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")でのデバッグがなく、DownloadLog.create(user_id: current_user.id, product_id: @product.id)の部分でエラーが起きているようです。
84
84
 
85
85
 
86
86
 

3

情報修正

2019/01/10 06:03

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -202,6 +202,6 @@
202
202
 
203
203
 
204
204
 
205
- staging環境のみで問題が起こる原因を究明したいです。
205
+ staging環境のみAbstractController::DoubleRenderErrorが起こる原因を究明したいです。
206
206
 
207
207
  ご教示いただけることがあれば、何卒よろしくお願いいたします。

2

情報追加

2019/01/10 06:02

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -114,7 +114,7 @@
114
114
 
115
115
  ```
116
116
 
117
- Rendering 500 with exception: undefined method `[]' for nil:NilClassとありますが、[]を記述していないので、なぜこのエラーができているのかわかりません。model/download_log.rbにも記述はありませんでした。
117
+ Rendering 500 with exception: undefined method `[]' for nil:NilClassとありますが、[]を記述していないので、なぜこのエラーができているのかわかりません。model/download_log.rbにもapplication_controller.rbのhandle500にも記述はありませんでした。
118
118
 
119
119
 
120
120
 
@@ -154,6 +154,50 @@
154
154
 
155
155
 
156
156
 
157
+ ```ruby
158
+
159
+ # application_controller.rb
160
+
161
+
162
+
163
+ class ApplicationController < ActionController::Base
164
+
165
+ protect_from_forgery with: :exception
166
+
167
+ rescue_from Exception, with: :handle_500 unless Rails.env.development?
168
+
169
+
170
+
171
+ def handle_500(exception = nil)
172
+
173
+ logger.error "Rendering 500 with exception: #{exception.message}" if exception
174
+
175
+ ExceptionNotifier.notify_exception(exception, env: request.env, data: {message: "error"})
176
+
177
+ respond_to do |format|
178
+
179
+ format.html {
180
+
181
+ return render template: 'errors/error_500', status: 500, layout: false, content_type: 'text/html'
182
+
183
+ }
184
+
185
+ format.all {
186
+
187
+ return head :internal_server_error
188
+
189
+ }
190
+
191
+ end
192
+
193
+ end
194
+
195
+ end
196
+
197
+ ```
198
+
199
+
200
+
157
201
  ## 実現したいこと
158
202
 
159
203
 

1

情報追加

2019/01/10 06:01

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -9,6 +9,16 @@
9
9
  ## エラー全文
10
10
 
11
11
  AbstractController::DoubleRenderError (Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return".):
12
+
13
+
14
+
15
+ ## 環境
16
+
17
+ macOS High Sierra(バージョン10.13.6)
18
+
19
+ ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin17]
20
+
21
+ Rails 4.2.6
12
22
 
13
23
 
14
24