質問編集履歴
4
コンソールからのレコード追加を試行
test
CHANGED
File without changes
|
test
CHANGED
@@ -400,7 +400,7 @@
|
|
400
400
|
|
401
401
|
[1] pry(main)>
|
402
402
|
|
403
|
-
[2] pry(main)> Contact.create(name:"Taro", mail:"test@gmail.com", mail_confirmation: "test@gmail.com", message: "hello world")
|
403
|
+
[2] pry(main)> contact = Contact.create(name:"Taro", mail:"test@gmail.com", mail_confirmation: "test@gmail.com", message: "hello world")
|
404
404
|
|
405
405
|
(0.4ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
|
406
406
|
|
3
コンソールからのレコード追加を試行
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,6 +24,10 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
+
rails c でコンソールから直接書き込もうとしてもNilになってしまいます。
|
28
|
+
|
29
|
+
|
30
|
+
|
27
31
|
### 該当のソースコード
|
28
32
|
|
29
33
|
|
@@ -386,6 +390,46 @@
|
|
386
390
|
|
387
391
|
|
388
392
|
|
393
|
+
**コンソールで直接追加を試行**
|
394
|
+
|
395
|
+
```rails c
|
396
|
+
|
397
|
+
$ bundle exec rails c
|
398
|
+
|
399
|
+
Loading development environment (Rails 5.2.4.4)
|
400
|
+
|
401
|
+
[1] pry(main)>
|
402
|
+
|
403
|
+
[2] pry(main)> Contact.create(name:"Taro", mail:"test@gmail.com", mail_confirmation: "test@gmail.com", message: "hello world")
|
404
|
+
|
405
|
+
(0.4ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
|
406
|
+
|
407
|
+
(0.1ms) BEGIN
|
408
|
+
|
409
|
+
Contact Create (0.3ms) INSERT INTO `contacts` (`created_at`, `updated_at`) VALUES ('2021-01-28 09:20:20', '2021-01-28 09:20:20')
|
410
|
+
|
411
|
+
(0.6ms) COMMIT
|
412
|
+
|
413
|
+
=> #<Contact:0x00007fb75bc29f10
|
414
|
+
|
415
|
+
id: 24,
|
416
|
+
|
417
|
+
name: nil,
|
418
|
+
|
419
|
+
mail: nil,
|
420
|
+
|
421
|
+
mail_confirmation: nil,
|
422
|
+
|
423
|
+
message: nil,
|
424
|
+
|
425
|
+
created_at: Thu, 28 Jan 2021 18:20:20 JST +09:00,
|
426
|
+
|
427
|
+
updated_at: Thu, 28 Jan 2021 18:20:20 JST +09:00>
|
428
|
+
|
429
|
+
[3] pry(main)>
|
430
|
+
|
431
|
+
```
|
432
|
+
|
389
433
|
|
390
434
|
|
391
435
|
### 補足情報(FW/ツールのバージョンなど)
|
2
if contact.save! を試した場合を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -214,7 +214,7 @@
|
|
214
214
|
|
215
215
|
|
216
216
|
|
217
|
-
binding.pryを
|
217
|
+
**binding.pryを試した場合**
|
218
218
|
|
219
219
|
|
220
220
|
|
@@ -258,6 +258,136 @@
|
|
258
258
|
|
259
259
|
|
260
260
|
|
261
|
+
**if contact.save! を試した場合**
|
262
|
+
|
263
|
+
```terminal
|
264
|
+
|
265
|
+
Started GET "/contact" for ::1 at 2021-01-27 17:51:17 +0900
|
266
|
+
|
267
|
+
Processing by ContactController#index as HTML
|
268
|
+
|
269
|
+
Rendering contact/index.html.haml within layouts/application
|
270
|
+
|
271
|
+
Rendered contact/index.html.haml within layouts/application (3.8ms)
|
272
|
+
|
273
|
+
Rendered layouts/_flash.html.haml (1.3ms)
|
274
|
+
|
275
|
+
Rendered layouts/_main_header.html.haml (6.7ms)
|
276
|
+
|
277
|
+
Rendered layouts/_session_controller.html.haml (2.2ms)
|
278
|
+
|
279
|
+
Rendered layouts/_main_footer.html.haml (5.7ms)
|
280
|
+
|
281
|
+
Completed 200 OK in 218ms (Views: 206.9ms | ActiveRecord: 1.9ms)
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
Started POST "/contact/confirm" for ::1 at 2021-01-27 17:51:33 +0900
|
288
|
+
|
289
|
+
Processing by ContactController#confirm as HTML
|
290
|
+
|
291
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"1udTs/YkCfBWq5tGcPve+X0FY6x4tCrzj/1R+XL8xdZxjtGmE30n0Mx0krayDKHWBeddQLc4AntxF0XivHsq8g==", "contact"=>{"name"=>"test", "mail"=>"test@sample.com", "mail_confirmation"=>"test@sample.com", "message"=>"sample"}, "commit"=>"確認"}
|
292
|
+
|
293
|
+
Rendering contact/confirm.html.haml within layouts/application
|
294
|
+
|
295
|
+
Rendered contact/confirm.html.haml within layouts/application (3.2ms)
|
296
|
+
|
297
|
+
Rendered layouts/_flash.html.haml (1.3ms)
|
298
|
+
|
299
|
+
Rendered layouts/_main_header.html.haml (3.3ms)
|
300
|
+
|
301
|
+
Rendered layouts/_session_controller.html.haml (1.5ms)
|
302
|
+
|
303
|
+
Rendered layouts/_main_footer.html.haml (3.6ms)
|
304
|
+
|
305
|
+
Completed 200 OK in 67ms (Views: 66.3ms | ActiveRecord: 0.0ms)
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
Started POST "/contact/complete" for ::1 at 2021-01-27 17:51:35 +0900
|
312
|
+
|
313
|
+
Processing by ContactController#complete as HTML
|
314
|
+
|
315
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ACdr0CyeD2YCH6u8hwilPj6N6fXGWLyxL7rDl6vVnPinTunFycchRpjAokxF/9oRRm/XGQnUlDnRUNeMZVJz3A==", "contact"=>{"name"=>"test", "mail"=>"test@sample.com", "mail_confirmation"=>"test@sample.com", "message"=>"sample"}, "commit"=>"送信"}
|
316
|
+
|
317
|
+
Rendering contact_mailer/received_email.text.haml
|
318
|
+
|
319
|
+
Rendered contact_mailer/received_email.text.haml (1.1ms)
|
320
|
+
|
321
|
+
ContactMailer#received_email: processed outbound mail in 9.7ms
|
322
|
+
|
323
|
+
/usr/bin/open file:////Users/01018540/projects/reframe-lab/tmp/letter_opener/1611737495_265122_610c5dc/plain.html
|
324
|
+
|
325
|
+
Sent mail to test@sample.com (6.5ms)
|
326
|
+
|
327
|
+
Date: Wed, 27 Jan 2021 17:51:35 +0900
|
328
|
+
|
329
|
+
From: example@example.com
|
330
|
+
|
331
|
+
To: test@sample.com
|
332
|
+
|
333
|
+
Message-ID: <6011299740a42_16a923fcfe39839cc381d9@CA6383.local.mail>
|
334
|
+
|
335
|
+
Subject: =?UTF-8?Q?=E3=81=8A=E5=95=8F=E3=81=84=E5=90=88=E3=82=8F=E3=81=9B=E3=82=92=E6=89=BF=E3=82=8A=E3=81=BE=E3=81=97=E3=81=9F?=
|
336
|
+
|
337
|
+
Mime-Version: 1.0
|
338
|
+
|
339
|
+
Content-Type: text/plain;
|
340
|
+
|
341
|
+
charset=UTF-8
|
342
|
+
|
343
|
+
Content-Transfer-Encoding: base64
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
V2Vi44K144Kk44OI44GL44KJ44GK5ZWP44GE5ZCI44KP44Gb44GM44GC44KK
|
348
|
+
|
349
|
+
44G+44GX44Gf44CCDQrllY/jgYTlkIjjgo/jgZvnlLvpnaLjgaflhaXlipvj
|
350
|
+
|
351
|
+
gZXjgozjgZ/msI/lkI06IHRlc3QNCuWVj+OBhOWQiOOCj+OBm+eUu+mdouOB
|
352
|
+
|
353
|
+
p+WFpeWKm+OBleOCjOOBn+ODoeODvOODq+OCouODieODrOOCuTogdGVzdEBz
|
354
|
+
|
355
|
+
YW1wbGUuY29tDQrllY/jgYTlkIjjgo/jgZvlhoXlrrk6DQpzYW1wbGUNCg==
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
(0.2ms) BEGIN
|
360
|
+
|
361
|
+
↳ app/controllers/contact_controller.rb:23
|
362
|
+
|
363
|
+
Contact Create (0.6ms) INSERT INTO `contacts` (`created_at`, `updated_at`) VALUES ('2021-01-27 08:51:35', '2021-01-27 08:51:35')
|
364
|
+
|
365
|
+
↳ app/controllers/contact_controller.rb:23
|
366
|
+
|
367
|
+
(2.0ms) COMMIT
|
368
|
+
|
369
|
+
↳ app/controllers/contact_controller.rb:23
|
370
|
+
|
371
|
+
Rendering contact/complete.html.haml within layouts/application
|
372
|
+
|
373
|
+
Rendered contact/complete.html.haml within layouts/application (1.9ms)
|
374
|
+
|
375
|
+
Rendered layouts/_flash.html.haml (1.0ms)
|
376
|
+
|
377
|
+
Rendered layouts/_main_header.html.haml (2.8ms)
|
378
|
+
|
379
|
+
Rendered layouts/_session_controller.html.haml (1.4ms)
|
380
|
+
|
381
|
+
Rendered layouts/_main_footer.html.haml (4.1ms)
|
382
|
+
|
383
|
+
Completed 200 OK in 85ms (Views: 57.0ms | ActiveRecord: 2.8ms)
|
384
|
+
|
385
|
+
```
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
261
391
|
### 補足情報(FW/ツールのバージョンなど)
|
262
392
|
|
263
393
|
|
1
誤認を与える文の削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -216,10 +216,6 @@
|
|
216
216
|
|
217
217
|
binding.pryを用いてみたところ、下記のことがわかっております。
|
218
218
|
|
219
|
-
・confirm → completeに移動する際、@contactの情報がnilになっている。
|
220
|
-
|
221
|
-
・ストロングパラーメタで設定しているcontact_paramsには情報が入っている。
|
222
|
-
|
223
219
|
|
224
220
|
|
225
221
|
```terminal
|