質問編集履歴
1
ログアウト処理のコントローラを明示、ログアウト時のエラーログを明示
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,7 +24,63 @@
|
|
24
24
|
|
25
25
|
```
|
26
26
|
|
27
|
+
ec2サーバー上でsudo tail -f log/production.logを実行した結果です
|
27
28
|
|
29
|
+
```
|
30
|
+
|
31
|
+
[2021-10-26T10:33:48.373111 #26769] INFO -- : [1860493b-41b3-4d0f-9b7e-e62894e7414d] Started GET "/logout" for 180.149.181.188 at 2021-10-26 10:33:48 +0000
|
32
|
+
|
33
|
+
F, [2021-10-26T10:33:48.373638 #26769] FATAL -- : [1860493b-41b3-4d0f-9b7e-e62894e7414d]
|
34
|
+
|
35
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] ActionController::RoutingError (No route matches [GET] "/logout"):
|
36
|
+
|
37
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d]
|
38
|
+
|
39
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] actionpack (6.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:36:in `call'
|
40
|
+
|
41
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] actionpack (6.0.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
|
42
|
+
|
43
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] railties (6.0.3) lib/rails/rack/logger.rb:37:in `call_app'
|
44
|
+
|
45
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] railties (6.0.3) lib/rails/rack/logger.rb:26:in `block in call'
|
46
|
+
|
47
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] activesupport (6.0.3) lib/active_support/tagged_logging.rb:80:in `block in tagged'
|
48
|
+
|
49
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] activesupport (6.0.3) lib/active_support/tagged_logging.rb:28:in `tagged'
|
50
|
+
|
51
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] activesupport (6.0.3) lib/active_support/tagged_logging.rb:80:in `tagged'
|
52
|
+
|
53
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] railties (6.0.3) lib/rails/rack/logger.rb:26:in `call'
|
54
|
+
|
55
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] actionpack (6.0.3) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
|
56
|
+
|
57
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] actionpack (6.0.3) lib/action_dispatch/middleware/request_id.rb:27:in `call'
|
58
|
+
|
59
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] rack (2.2.3) lib/rack/method_override.rb:24:in `call'
|
60
|
+
|
61
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] rack (2.2.3) lib/rack/runtime.rb:22:in `call'
|
62
|
+
|
63
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] activesupport (6.0.3) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
|
64
|
+
|
65
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] actionpack (6.0.3) lib/action_dispatch/middleware/executor.rb:14:in `call'
|
66
|
+
|
67
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
|
68
|
+
|
69
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] actionpack (6.0.3) lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
|
70
|
+
|
71
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] railties (6.0.3) lib/rails/engine.rb:527:in `call'
|
72
|
+
|
73
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] puma (4.3.6) lib/puma/configuration.rb:228:in `call'
|
74
|
+
|
75
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] puma (4.3.6) lib/puma/server.rb:713:in `handle_request'
|
76
|
+
|
77
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] puma (4.3.6) lib/puma/server.rb:472:in `process_client'
|
78
|
+
|
79
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] puma (4.3.6) lib/puma/server.rb:328:in `block in run'
|
80
|
+
|
81
|
+
[1860493b-41b3-4d0f-9b7e-e62894e7414d] puma (4.3.6) lib/puma/thread_pool.rb:134:in `block in spawn_thread'
|
82
|
+
|
83
|
+
```
|
28
84
|
|
29
85
|
### 該当のソースコード
|
30
86
|
|
@@ -50,6 +106,36 @@
|
|
50
106
|
|
51
107
|
```
|
52
108
|
|
109
|
+
ログアウト処理のコントローラ
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
def destroy
|
114
|
+
|
115
|
+
log_out if logged_in?
|
116
|
+
|
117
|
+
redirect_to root_path
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
```
|
122
|
+
|
123
|
+
log_outメソッド
|
124
|
+
|
125
|
+
```
|
126
|
+
|
127
|
+
def log_out
|
128
|
+
|
129
|
+
forget(current_end_user)
|
130
|
+
|
131
|
+
session.delete(:end_user_id)
|
132
|
+
|
133
|
+
@current_end_user = nil
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
```
|
138
|
+
|
53
139
|
|
54
140
|
|
55
141
|
### 試したこと
|