質問編集履歴
5
原因はこれかも
test
CHANGED
File without changes
|
test
CHANGED
@@ -107,3 +107,47 @@
|
|
107
107
|
|
108
108
|
|
109
109
|
```
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
2017/11/08 追記
|
114
|
+
|
115
|
+
flashが表示されない原因が分かったかもです。
|
116
|
+
|
117
|
+
コントローラのsign_out でログアウトするため、
|
118
|
+
|
119
|
+
セッションと共にflashの内容も消えてるのだと思います。
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
そこで以下のようにしました
|
124
|
+
|
125
|
+
※controllers/application_controller.rb
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
|
129
|
+
#flash.now[:alert] = '退職者はログインできません'
|
130
|
+
|
131
|
+
redirect_to "/employees/sign_in", alert: '退職者はログインできません'
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
```
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
ですが下のようにDoubleRenderエラーになってしまいます。
|
142
|
+
|
143
|
+
![イメージ説明](6c79feacee5eca3bc4180756a37cd005.jpeg)
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
ダブルレンダーエラーを回避出来ればメッセージを表示できそうに思うのですが
|
148
|
+
|
149
|
+
分かる方教えていただけないでしょうか?
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
宜しくお願い致します。
|
4
不要な部分を削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,23 +24,15 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
//ログインの可否判定
|
28
27
|
|
28
|
+
|
29
|
-
|
29
|
+
1.ログインの可否判定 ※controllers/application_controller.rb
|
30
30
|
|
31
31
|
|
32
32
|
|
33
33
|
```ruby
|
34
34
|
|
35
35
|
class ApplicationController < ActionController::Base
|
36
|
-
|
37
|
-
before_action :authenticate_employee!
|
38
|
-
|
39
|
-
before_action :configure_permitted_parameters, if: :devise_controller?
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
protect_from_forgery with: :exception
|
44
36
|
|
45
37
|
|
46
38
|
|
@@ -72,109 +64,7 @@
|
|
72
64
|
|
73
65
|
|
74
66
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
67
|
```
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
//ログイン画面
|
92
|
-
|
93
|
-
//views/devise/sessions/new.html.erb
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
```ruby
|
98
|
-
|
99
|
-
<div class="container-fluid">
|
100
|
-
|
101
|
-
<div class="row">
|
102
|
-
|
103
|
-
<div class="col-xs-8 col-xs-offset-2">
|
104
|
-
|
105
|
-
<h2>ログイン画面</h2>
|
106
|
-
|
107
|
-
</div>
|
108
|
-
|
109
|
-
</div>
|
110
|
-
|
111
|
-
</div>
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
<div class="container-fluid">
|
118
|
-
|
119
|
-
<div class="row">
|
120
|
-
|
121
|
-
<div class="col-xs-8 col-xs-offset-2">
|
122
|
-
|
123
|
-
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
124
|
-
|
125
|
-
<div class="field">
|
126
|
-
|
127
|
-
<%= f.label :email %><br />
|
128
|
-
|
129
|
-
<%= f.email_field :email, autofocus: true %>
|
130
|
-
|
131
|
-
</div>
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
<div class="field">
|
136
|
-
|
137
|
-
<%= f.label :password %><br />
|
138
|
-
|
139
|
-
<%= f.password_field :password, autocomplete: "off" %>
|
140
|
-
|
141
|
-
</div>
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
<% if devise_mapping.rememberable? -%>
|
146
|
-
|
147
|
-
<div class="field">
|
148
|
-
|
149
|
-
<%= f.check_box :remember_me %>
|
150
|
-
|
151
|
-
<%= f.label :remember_me %>
|
152
|
-
|
153
|
-
</div>
|
154
|
-
|
155
|
-
<% end -%>
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
<div class="actions">
|
160
|
-
|
161
|
-
<%= f.submit "ログイン" %>
|
162
|
-
|
163
|
-
</div>
|
164
|
-
|
165
|
-
<% end %>
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
<%= render "devise/shared/links" %>
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
</div>
|
174
|
-
|
175
|
-
</div>
|
176
|
-
|
177
|
-
</div>
|
178
68
|
|
179
69
|
|
180
70
|
|
@@ -186,15 +76,11 @@
|
|
186
76
|
|
187
77
|
|
188
78
|
|
189
|
-
```
|
190
79
|
|
191
80
|
|
192
81
|
|
193
82
|
|
194
|
-
|
195
|
-
//共通レイアウト部分(アラート表示部分)
|
196
|
-
|
197
|
-
|
83
|
+
2.アラート表示部分 ※views/layouts/application.html.erb
|
198
84
|
|
199
85
|
|
200
86
|
|
@@ -202,84 +88,22 @@
|
|
202
88
|
|
203
89
|
|
204
90
|
|
205
|
-
<
|
91
|
+
<div class="row">
|
206
92
|
|
93
|
+
|
94
|
+
|
207
|
-
<
|
95
|
+
<% if alert %>
|
96
|
+
|
97
|
+
<%= alert %>
|
98
|
+
|
99
|
+
<% end %>
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
</div>
|
208
104
|
|
209
105
|
|
210
106
|
|
211
107
|
|
212
108
|
|
213
|
-
<head>
|
214
|
-
|
215
|
-
<meta charset="utf-8">
|
216
|
-
|
217
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
218
|
-
|
219
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
</head>
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
<body class='<%= "#{controller.controller_name}" %>'>
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
<div class="wrap">
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
<div class="row">
|
248
|
-
|
249
|
-
<div class="col-xs-4 col-xs-offset-1" >
|
250
|
-
|
251
|
-
<% if alert %>
|
252
|
-
|
253
|
-
<p class="alert"><%= alert %></p>
|
254
|
-
|
255
|
-
<% end %>
|
256
|
-
|
257
|
-
</div>
|
258
|
-
|
259
|
-
</div>
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
<%= yield %>
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
</div>
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
</body>
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
</html>
|
282
|
-
|
283
|
-
|
284
|
-
|
285
109
|
```
|
3
sd
test
CHANGED
File without changes
|
test
CHANGED
@@ -192,7 +192,7 @@
|
|
192
192
|
|
193
193
|
|
194
194
|
|
195
|
-
//共通レイアウト部分(アラート表示部)
|
195
|
+
//共通レイアウト部分(アラート表示部分)
|
196
196
|
|
197
197
|
//views/layouts/application.html.erb
|
198
198
|
|
@@ -242,43 +242,7 @@
|
|
242
242
|
|
243
243
|
|
244
244
|
|
245
|
-
|
245
|
+
|
246
|
-
|
247
|
-
<div class="row header_top">
|
248
|
-
|
249
|
-
<%= render 'shared/header_menu_top' %>
|
250
|
-
|
251
|
-
</div>
|
252
|
-
|
253
|
-
<div class="row header_bottom">
|
254
|
-
|
255
|
-
<%= render 'shared/header_menu_bottom' %>
|
256
|
-
|
257
|
-
</div>
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
<div class="row notice_wrap">
|
262
|
-
|
263
|
-
<div class="col-xs-4 col-xs-offset-1" >
|
264
|
-
|
265
|
-
<% if flash.notice %>
|
266
|
-
|
267
|
-
<p><%= flash.notice %></p>
|
268
|
-
|
269
|
-
<% end %>
|
270
|
-
|
271
|
-
</div>
|
272
|
-
|
273
|
-
</div>
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
<% end %>
|
280
|
-
|
281
|
-
|
282
246
|
|
283
247
|
<div class="row">
|
284
248
|
|
2
a
test
CHANGED
File without changes
|
test
CHANGED
@@ -187,3 +187,135 @@
|
|
187
187
|
|
188
188
|
|
189
189
|
```
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
//共通レイアウト部分(アラート表示部)
|
196
|
+
|
197
|
+
//views/layouts/application.html.erb
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
```ruby
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<!DOCTYPE html>
|
206
|
+
|
207
|
+
<html lang="ja">
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<head>
|
214
|
+
|
215
|
+
<meta charset="utf-8">
|
216
|
+
|
217
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
218
|
+
|
219
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
</head>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
<body class='<%= "#{controller.controller_name}" %>'>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
<div class="wrap">
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
<% if employee_signed_in? %>
|
246
|
+
|
247
|
+
<div class="row header_top">
|
248
|
+
|
249
|
+
<%= render 'shared/header_menu_top' %>
|
250
|
+
|
251
|
+
</div>
|
252
|
+
|
253
|
+
<div class="row header_bottom">
|
254
|
+
|
255
|
+
<%= render 'shared/header_menu_bottom' %>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
<div class="row notice_wrap">
|
262
|
+
|
263
|
+
<div class="col-xs-4 col-xs-offset-1" >
|
264
|
+
|
265
|
+
<% if flash.notice %>
|
266
|
+
|
267
|
+
<p><%= flash.notice %></p>
|
268
|
+
|
269
|
+
<% end %>
|
270
|
+
|
271
|
+
</div>
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
<% end %>
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
<div class="row">
|
284
|
+
|
285
|
+
<div class="col-xs-4 col-xs-offset-1" >
|
286
|
+
|
287
|
+
<% if alert %>
|
288
|
+
|
289
|
+
<p class="alert"><%= alert %></p>
|
290
|
+
|
291
|
+
<% end %>
|
292
|
+
|
293
|
+
</div>
|
294
|
+
|
295
|
+
</div>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
<%= yield %>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
</body>
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
</html>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
```
|
1
あ
test
CHANGED
File without changes
|
test
CHANGED
@@ -62,7 +62,7 @@
|
|
62
62
|
|
63
63
|
#こちらも表示されない
|
64
64
|
|
65
|
-
flash.now[:
|
65
|
+
flash.now[:alert] = '退職者はログインできません'
|
66
66
|
|
67
67
|
end
|
68
68
|
|