質問編集履歴

5

修正

2021/09/29 04:06

投稿

kwtkwt
kwtkwt

スコア21

test CHANGED
File without changes
test CHANGED
@@ -268,21 +268,51 @@
268
268
 
269
269
  ```
270
270
 
271
+ Started PUT "/user_devises" for 127.0.0.1 at 2021-09-29 13:05:38 +0900
272
+
271
273
  Processing by UserDevises::RegistrationsController#update as HTML
272
274
 
273
- Parameters: {"utf8"=>"✓", "authenticity_token"=>"JQJJ3WRPF7+PYH442UrYHi0NkCg6ayngQFV/Mrm47gpuA389GWfQOHuRN6ic1xdFsrY0L5TqBA3HUTl5eCnhdA==", "user_devise"=>{"email"=>"aaa@gmail.com", "current_password"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "name"=>"氏名", "furigane"=>"", "birthday"=>"", "sex"=>"", "profession"=>"", "career"=>"", "number"=>"", "address"=>"", "pr"=>""}, "commit"=>"更新"}
275
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"IgQ/mQGRhPjXa0j2KiPL8E049P2UannNI7B3YTVmV6WDhgnXcG5J4jXOnIMLU/kfEdNlZ0HruahBc0gnZ56IEQ==", "user_devise"=>{"email"=>"aaa@gmail.com", "current_password"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "name"=>"氏名", "furigane"=>"", "birthday"=>"", "sex"=>"", "profession"=>"", "career"=>"", "number"=>"", "address"=>"", "pr"=>""}, "commit"=>"更新"}
276
+
277
+ UserDevise Load (0.3ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = ? ORDER BY "user_devises"."id" ASC LIMIT ? [["id", 5], ["LIMIT", 1]]
278
+
279
+ UserDevise Load (0.3ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = ? LIMIT ? [["id", 5], ["LIMIT", 1]]
280
+
281
+ (0.1ms) begin transaction
282
+
283
+ (0.1ms) commit transaction
284
+
285
+ Redirected to http://localhost:3000/user_devises/5
286
+
287
+ Completed 302 Found in 268ms (ActiveRecord: 0.7ms)
288
+
289
+
290
+
291
+
292
+
293
+ Started GET "/user_devises/5" for 127.0.0.1 at 2021-09-29 13:05:38 +0900
294
+
295
+ Processing by UserDevisesController#show as HTML
296
+
297
+ Parameters: {"id"=>"5"}
298
+
299
+ UserDevise Load (0.2ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = ? LIMIT ? [["id", 5], ["LIMIT", 1]]
274
300
 
275
301
  UserDevise Load (0.4ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = ? ORDER BY "user_devises"."id" ASC LIMIT ? [["id", 5], ["LIMIT", 1]]
276
302
 
303
+ Rendering user_devises/show.html.erb within layouts/application
304
+
277
- UserDevise Load (0.3ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = ? LIMIT ? [["id", 5], ["LIMIT", 1]]
305
+ Apply Load (0.3ms) SELECT "applies".* FROM "applies" WHERE "applies"."user_id" = ? [["user_id", 5]]
278
-
279
- (0.1ms) begin transaction
306
+
280
-
281
- SQL (0.5ms) UPDATE "user_devises" SET "name" = ?, "updated_at" = ? WHERE "user_devises"."id" = ? [["name", "氏名"], ["updated_at", "2021-09-29 01:01:35.509090"], ["id", 5]]
282
-
283
- (0.9ms) commit transaction
284
-
285
- Redirected to http://localhost:3000/user_devises/5
307
+ Rendered user_devises/show.html.erb within layouts/application (3.2ms)
308
+
309
+ Rendered shared/_header.html.erb (0.8ms)
310
+
311
+ Rendered shared/_footer.html.erb (0.4ms)
312
+
313
+ Completed 200 OK in 92ms (Views: 86.8ms | ActiveRecord: 0.9ms)
314
+
315
+
286
316
 
287
317
  ```
288
318
 
@@ -294,15 +324,27 @@
294
324
 
295
325
  ```
296
326
 
297
- 2021-09-29T01:04:25.897376+00:00 app[web.1]: I, [2021-09-29T01:04:25.897326 #13] INFO -- : [b0173214-c366-487e-826c-c1f9eb4dfac9] Processing by UserDevises::RegistrationsController#update as HTML
298
-
299
- 2021-09-29T01:04:25.897432+00:00 app[web.1]: I, [2021-09-29T01:04:25.897405 #13] INFO -- : [b0173214-c366-487e-826c-c1f9eb4dfac9] Parameters: {"utf8"=>"✓", "authenticity_token"=>"PutUuGwrIXmeraoWHEqiYuJ1OdbAc6TRZTR1ODRCdc6coYyAlgtzUgJquOFOuo98zciKMKYlpcikr//tQCypCQ==", "user_devise"=>{"email"=>"aaa@gmail.com", "current_password"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "name"=>"氏名", "furigane"=>"", "birthday"=>"", "sex"=>"", "profession"=>"", "career"=>"", "number"=>"", "address"=>"", "pr"=>""}, "commit"=>"更新"}
300
-
301
- 2021-09-29T01:04:25.900540+00:00 app[web.1]: D, [2021-09-29T01:04:25.900483 #13] DEBUG -- : [b0173214-c366-487e-826c-c1f9eb4dfac9] UserDevise Load (1.1ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = $1 ORDER BY "user_devises"."id" ASC LIMIT $2 [["id", 8], ["LIMIT", 1]]
302
-
303
- 2021-09-29T01:04:25.902700+00:00 app[web.1]: D, [2021-09-29T01:04:25.902619 #13] DEBUG -- : [b0173214-c366-487e-826c-c1f9eb4dfac9] UserDevise Load (0.8ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = $1 LIMIT $2 [["id", 8], ["LIMIT", 1]]
304
-
305
- 2021-09-29T01:04:26.162336+00:00 heroku[router]: at=info method=POST path="/user_devises" host=job-offer-rkrk.herokuapp.com request_id=b0173214-c366-487e-826c-c1f9eb4dfac9 fwd="60.66.62.161" dyno=web.1 connect=0ms service=276ms status=200 bytes=3423 protocol=https
327
+ 2021-09-29T04:02:58.344402+00:00 app[web.1]: I, [2021-09-29T04:02:58.344324 #13] INFO -- : [7b81d83d-056d-48ab-82a2-8e1908d5bc83] Started PUT "/user_devises" for 60.66.62.161 at 2021-09-29 04:02:58 +0000
328
+
329
+ 2021-09-29T04:02:58.345121+00:00 app[web.1]: I, [2021-09-29T04:02:58.345074 #13] INFO -- : [7b81d83d-056d-48ab-82a2-8e1908d5bc83] Processing by UserDevises::RegistrationsController#update as HTML
330
+
331
+ 2021-09-29T04:02:58.345193+00:00 app[web.1]: I, [2021-09-29T04:02:58.345162 #13] INFO -- : [7b81d83d-056d-48ab-82a2-8e1908d5bc83] Parameters: {"utf8"=>"✓", "authenticity_token"=>"W/sUWu+B9Cdsi4PSMWoSIMNjOwQc7KHvp6tUBJIpSRpMYCGrno+m+9oWmB2QwNKJeuu4ErNo4zOEWt61r68vOw==", "user_devise"=>{"email"=>"aaa@yahoo.co.jp", "current_password"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "name"=>"氏名", "furigane"=>"", "birthday"=>"", "sex"=>"", "profession"=>"", "career"=>"", "number"=>"", "address"=>"", "pr"=>""}, "commit"=>"更新"}
332
+
333
+ 2021-09-29T04:02:58.347617+00:00 app[web.1]: D, [2021-09-29T04:02:58.347565 #13] DEBUG -- : [7b81d83d-056d-48ab-82a2-8e1908d5bc83] UserDevise Load (0.8ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = $1 ORDER BY "user_devises"."id" ASC LIMIT $2 [["id", 6], ["LIMIT", 1]]
334
+
335
+ 2021-09-29T04:02:58.349154+00:00 app[web.1]: D, [2021-09-29T04:02:58.349105 #13] DEBUG -- : [7b81d83d-056d-48ab-82a2-8e1908d5bc83] UserDevise Load (0.7ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = $1 LIMIT $2 [["id", 6], ["LIMIT", 1]]
336
+
337
+ 2021-09-29T04:02:58.612590+00:00 heroku[router]: at=info method=POST path="/user_devises" host=job-offer-rkrk.herokuapp.com request_id=7b81d83d-056d-48ab-82a2-8e1908d5bc83 fwd="60.66.62.161" dyno=web.1 connect=0ms service=272ms status=200 bytes=3425 protocol=https
338
+
339
+ 2021-09-29T04:02:58.609016+00:00 app[web.1]: I, [2021-09-29T04:02:58.608857 #13] INFO -- : [7b81d83d-056d-48ab-82a2-8e1908d5bc83] Rendering devise/registrations/edit.html.erb within layouts/application
340
+
341
+ 2021-09-29T04:02:58.609943+00:00 app[web.1]: I, [2021-09-29T04:02:58.609894 #13] INFO -- : [7b81d83d-056d-48ab-82a2-8e1908d5bc83] Rendered devise/registrations/edit.html.erb within layouts/application (0.9ms)
342
+
343
+ 2021-09-29T04:02:58.610711+00:00 app[web.1]: I, [2021-09-29T04:02:58.610649 #13] INFO -- : [7b81d83d-056d-48ab-82a2-8e1908d5bc83] Rendered shared/_header.html.erb (0.2ms)
344
+
345
+ 2021-09-29T04:02:58.610867+00:00 app[web.1]: I, [2021-09-29T04:02:58.610837 #13] INFO -- : [7b81d83d-056d-48ab-82a2-8e1908d5bc83] Rendered shared/_footer.html.erb (0.0ms)
346
+
347
+ 2021-09-29T04:02:58.611024+00:00 app[web.1]: I, [2021-09-29T04:02:58.610996 #13] INFO -- : [7b81d83d-056d-48ab-82a2-8e1908d5bc83] Completed 200 OK in 266ms (Views: 2.3ms | ActiveRecord: 1.5ms)
306
348
 
307
349
  ```
308
350
 

4

コード追加

2021/09/29 04:06

投稿

kwtkwt
kwtkwt

スコア21

test CHANGED
File without changes
test CHANGED
@@ -6,6 +6,258 @@
6
6
 
7
7
 
8
8
 
9
+ # コード
10
+
11
+ app/controllers/user_devises/registrations_controller.rb
12
+
13
+ ```ruby
14
+
15
+ # frozen_string_literal: true
16
+
17
+
18
+
19
+ class UserDevises::RegistrationsController < Devise::RegistrationsController
20
+
21
+ # before_action :configure_sign_up_params, only: [:create]
22
+
23
+ # before_action :configure_account_update_params, only: [:update]
24
+
25
+
26
+
27
+ # GET /resource/sign_up
28
+
29
+ # def new
30
+
31
+ # super
32
+
33
+ # end
34
+
35
+
36
+
37
+ # POST /resource
38
+
39
+ # def create
40
+
41
+ # super
42
+
43
+ # end
44
+
45
+
46
+
47
+ # GET /resource/edit
48
+
49
+ # def edit
50
+
51
+ # super
52
+
53
+ # end
54
+
55
+
56
+
57
+ # PUT /resource
58
+
59
+ # def update
60
+
61
+ # super
62
+
63
+ # end
64
+
65
+
66
+
67
+ # DELETE /resource
68
+
69
+ # def destroy
70
+
71
+ # super
72
+
73
+ # end
74
+
75
+
76
+
77
+ # GET /resource/cancel
78
+
79
+ # Forces the session data which is usually expired after sign
80
+
81
+ # in to be expired now. This is useful if the user wants to
82
+
83
+ # cancel oauth signing in/up in the middle of the process,
84
+
85
+ # removing all OAuth session data.
86
+
87
+ # def cancel
88
+
89
+ # super
90
+
91
+ # end
92
+
93
+
94
+
95
+ # protected
96
+
97
+
98
+
99
+ # If you have extra params to permit, append them to the sanitizer.
100
+
101
+ # def configure_sign_up_params
102
+
103
+ # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
104
+
105
+ # end
106
+
107
+
108
+
109
+ # If you have extra params to permit, append them to the sanitizer.
110
+
111
+ # def configure_account_update_params
112
+
113
+ # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
114
+
115
+ # end
116
+
117
+
118
+
119
+ #アカウント登録後のリダイレクト先
120
+
121
+ def after_sign_up_path_for(resource)
122
+
123
+
124
+
125
+ end
126
+
127
+
128
+
129
+ #アカウント情報、プロフィール編集後のリダイレクト先
130
+
131
+ def after_update_path_for(resource)
132
+
133
+ # マイページへ遷移
134
+
135
+ user_devise_path(resource.id)
136
+
137
+ end
138
+
139
+
140
+
141
+ # The path used after sign up for inactive accounts.
142
+
143
+ # def after_inactive_sign_up_path_for(resource)
144
+
145
+ # super(resource)
146
+
147
+ # end
148
+
149
+ end
150
+
151
+ ```
152
+
153
+
154
+
155
+ app/controllers/application_controller.rb
156
+
157
+ ```ruby
158
+
159
+ class ApplicationController < ActionController::Base
160
+
161
+ protect_from_forgery with: :exception
162
+
163
+ include SessionsHelper
164
+
165
+
166
+
167
+ # ログイン後に遷移するページ
168
+
169
+ def after_sign_in_path_for(resource)
170
+
171
+ mypage_companies_path(resource)
172
+
173
+ end
174
+
175
+
176
+
177
+ def after_sign_in_path_for(resource)
178
+
179
+ case resource
180
+
181
+
182
+
183
+ when Company
184
+
185
+ mypage_companies_path(resource)
186
+
187
+
188
+
189
+ when UserDevise
190
+
191
+ mypage_user_devises_path(resource)
192
+
193
+ end
194
+
195
+ end
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+ # deviseコントローラーにストロングパラメータを追加する
206
+
207
+ before_action :configure_permitted_parameters, if: :devise_controller?
208
+
209
+
210
+
211
+ protected
212
+
213
+ def configure_permitted_parameters
214
+
215
+ # サインアップ時にnameのストロングパラメータを追加
216
+
217
+ # devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :furigane])
218
+
219
+
220
+
221
+
222
+
223
+ # アカウント編集の時にnameとprofileのストロングパラメータを追加
224
+
225
+ devise_parameter_sanitizer.permit(:account_update, keys: [:name, :furigane, :birthday, :sex, :profession, :career, :number, :address, :pr])
226
+
227
+ end
228
+
229
+ end
230
+
231
+ ```
232
+
233
+
234
+
235
+ app/controllers/user_devises_controller.rb
236
+
237
+ ```ruby
238
+
239
+ class UserDevisesController < ApplicationController
240
+
241
+ def show
242
+
243
+ @user_devise = UserDevise.find(params[:id])
244
+
245
+ @jobs = Apply.where(user_id: current_user_devise.id)
246
+
247
+ end
248
+
249
+ end
250
+
251
+
252
+
253
+
254
+
255
+ ```
256
+
257
+
258
+
259
+
260
+
9
261
 
10
262
 
11
263
  ### 発生している問題・エラーメッセージ・ログ

3

バージョン追加

2021/09/29 04:03

投稿

kwtkwt
kwtkwt

スコア21

test CHANGED
File without changes
test CHANGED
@@ -78,6 +78,8 @@
78
78
 
79
79
  Rails 5.1.6
80
80
 
81
+ heroku/7.59.0 darwin-x64 node-v12.21.0
82
+
81
83
 
82
84
 
83
85
 

2

ログ修正

2021/09/29 01:36

投稿

kwtkwt
kwtkwt

スコア21

test CHANGED
File without changes
test CHANGED
@@ -42,6 +42,8 @@
42
42
 
43
43
  ```
44
44
 
45
+ 2021-09-29T01:04:25.897376+00:00 app[web.1]: I, [2021-09-29T01:04:25.897326 #13] INFO -- : [b0173214-c366-487e-826c-c1f9eb4dfac9] Processing by UserDevises::RegistrationsController#update as HTML
46
+
45
47
  2021-09-29T01:04:25.897432+00:00 app[web.1]: I, [2021-09-29T01:04:25.897405 #13] INFO -- : [b0173214-c366-487e-826c-c1f9eb4dfac9] Parameters: {"utf8"=>"✓", "authenticity_token"=>"PutUuGwrIXmeraoWHEqiYuJ1OdbAc6TRZTR1ODRCdc6coYyAlgtzUgJquOFOuo98zciKMKYlpcikr//tQCypCQ==", "user_devise"=>{"email"=>"aaa@gmail.com", "current_password"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "name"=>"氏名", "furigane"=>"", "birthday"=>"", "sex"=>"", "profession"=>"", "career"=>"", "number"=>"", "address"=>"", "pr"=>""}, "commit"=>"更新"}
46
48
 
47
49
  2021-09-29T01:04:25.900540+00:00 app[web.1]: D, [2021-09-29T01:04:25.900483 #13] DEBUG -- : [b0173214-c366-487e-826c-c1f9eb4dfac9] UserDevise Load (1.1ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = $1 ORDER BY "user_devises"."id" ASC LIMIT $2 [["id", 8], ["LIMIT", 1]]

1

個人情報

2021/09/29 01:35

投稿

kwtkwt
kwtkwt

スコア21

test CHANGED
File without changes
test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  Processing by UserDevises::RegistrationsController#update as HTML
20
20
 
21
- Parameters: {"utf8"=>"✓", "authenticity_token"=>"JQJJ3WRPF7+PYH442UrYHi0NkCg6ayngQFV/Mrm47gpuA389GWfQOHuRN6ic1xdFsrY0L5TqBA3HUTl5eCnhdA==", "user_devise"=>{"email"=>"baseballryuki5155@gmail.com", "current_password"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "name"=>"氏名", "furigane"=>"", "birthday"=>"", "sex"=>"", "profession"=>"", "career"=>"", "number"=>"", "address"=>"", "pr"=>""}, "commit"=>"更新"}
21
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"JQJJ3WRPF7+PYH442UrYHi0NkCg6ayngQFV/Mrm47gpuA389GWfQOHuRN6ic1xdFsrY0L5TqBA3HUTl5eCnhdA==", "user_devise"=>{"email"=>"aaa@gmail.com", "current_password"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "name"=>"氏名", "furigane"=>"", "birthday"=>"", "sex"=>"", "profession"=>"", "career"=>"", "number"=>"", "address"=>"", "pr"=>""}, "commit"=>"更新"}
22
22
 
23
23
  UserDevise Load (0.4ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = ? ORDER BY "user_devises"."id" ASC LIMIT ? [["id", 5], ["LIMIT", 1]]
24
24
 
@@ -42,7 +42,7 @@
42
42
 
43
43
  ```
44
44
 
45
- 2021-09-29T01:04:25.897432+00:00 app[web.1]: I, [2021-09-29T01:04:25.897405 #13] INFO -- : [b0173214-c366-487e-826c-c1f9eb4dfac9] Parameters: {"utf8"=>"✓", "authenticity_token"=>"PutUuGwrIXmeraoWHEqiYuJ1OdbAc6TRZTR1ODRCdc6coYyAlgtzUgJquOFOuo98zciKMKYlpcikr//tQCypCQ==", "user_devise"=>{"email"=>"baseballryuki5155@gmail.com", "current_password"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "name"=>"カワタリュウキ", "furigane"=>"", "birthday"=>"", "sex"=>"", "profession"=>"", "career"=>"", "number"=>"", "address"=>"", "pr"=>""}, "commit"=>"更新"}
45
+ 2021-09-29T01:04:25.897432+00:00 app[web.1]: I, [2021-09-29T01:04:25.897405 #13] INFO -- : [b0173214-c366-487e-826c-c1f9eb4dfac9] Parameters: {"utf8"=>"✓", "authenticity_token"=>"PutUuGwrIXmeraoWHEqiYuJ1OdbAc6TRZTR1ODRCdc6coYyAlgtzUgJquOFOuo98zciKMKYlpcikr//tQCypCQ==", "user_devise"=>{"email"=>"aaa@gmail.com", "current_password"=>"[FILTERED]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "name"=>"氏名", "furigane"=>"", "birthday"=>"", "sex"=>"", "profession"=>"", "career"=>"", "number"=>"", "address"=>"", "pr"=>""}, "commit"=>"更新"}
46
46
 
47
47
  2021-09-29T01:04:25.900540+00:00 app[web.1]: D, [2021-09-29T01:04:25.900483 #13] DEBUG -- : [b0173214-c366-487e-826c-c1f9eb4dfac9] UserDevise Load (1.1ms) SELECT "user_devises".* FROM "user_devises" WHERE "user_devises"."id" = $1 ORDER BY "user_devises"."id" ASC LIMIT $2 [["id", 8], ["LIMIT", 1]]
48
48