質問編集履歴
8
createの変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -330,10 +330,6 @@
|
|
330
330
|
|
331
331
|
@tasks = TaskCollection.new(current_user, tasks_params)
|
332
332
|
|
333
|
-
@tasks.collection.each{|task| task.save! }
|
334
|
-
|
335
|
-
@tasks.each{|task| task.save! }
|
336
|
-
|
337
333
|
if @tasks.save
|
338
334
|
|
339
335
|
flash[:success] = "作成しました!"
|
7
エラー画面の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
エラー画面
|
26
26
|
|
27
|
-
![イメージ説明](
|
27
|
+
![イメージ説明](beebd7621287e514d5130fe0c08dcfba.png)
|
28
28
|
|
29
29
|
app/views/tasks/new.html.erb
|
30
30
|
|
6
createの変更とエラー画面の変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
エラー画面
|
26
26
|
|
27
|
-
![イメージ説明](c
|
27
|
+
![イメージ説明](ddbcedad09db4da1d31ba0d760b067a6.png)
|
28
28
|
|
29
29
|
app/views/tasks/new.html.erb
|
30
30
|
|
@@ -328,7 +328,9 @@
|
|
328
328
|
|
329
329
|
#変更
|
330
330
|
|
331
|
+
@tasks = TaskCollection.new(current_user, tasks_params)
|
332
|
+
|
331
|
-
@tasks.collection.each{|task| task.save! }
|
333
|
+
@tasks.collection.each{|task| task.save! }
|
332
334
|
|
333
335
|
@tasks.each{|task| task.save! }
|
334
336
|
|
@@ -340,7 +342,19 @@
|
|
340
342
|
|
341
343
|
else
|
342
344
|
|
345
|
+
|
346
|
+
|
347
|
+
def update
|
348
|
+
|
349
|
+
if current_user.update(user_tasks_params)
|
350
|
+
|
351
|
+
flash[:success] = "編集しました!"
|
352
|
+
|
353
|
+
redirect_to task_path(current_user)
|
354
|
+
|
355
|
+
else
|
356
|
+
|
343
|
-
render '
|
357
|
+
render 'tasks/edit'
|
344
358
|
|
345
359
|
end
|
346
360
|
|
@@ -348,24 +362,6 @@
|
|
348
362
|
|
349
363
|
|
350
364
|
|
351
|
-
def update
|
352
|
-
|
353
|
-
if current_user.update(user_tasks_params)
|
354
|
-
|
355
|
-
flash[:success] = "編集しました!"
|
356
|
-
|
357
|
-
redirect_to task_path(current_user)
|
358
|
-
|
359
|
-
else
|
360
|
-
|
361
|
-
render 'tasks/edit'
|
362
|
-
|
363
|
-
end
|
364
|
-
|
365
|
-
end
|
366
|
-
|
367
|
-
|
368
|
-
|
369
365
|
private
|
370
366
|
|
371
367
|
|
5
createの変更とエラー画面の変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
エラー画面
|
26
26
|
|
27
|
-
![イメージ説明](
|
27
|
+
![イメージ説明](c80bbc15636ff581b529b4f48c55f90f.png)
|
28
28
|
|
29
29
|
app/views/tasks/new.html.erb
|
30
30
|
|
@@ -328,11 +328,11 @@
|
|
328
328
|
|
329
329
|
#変更
|
330
330
|
|
331
|
-
def create
|
332
|
-
|
333
|
-
|
331
|
+
@tasks.collection.each{|task| task.save! }
|
334
|
-
|
332
|
+
|
335
|
-
|
333
|
+
@tasks.each{|task| task.save! }
|
334
|
+
|
335
|
+
if @tasks.save
|
336
336
|
|
337
337
|
flash[:success] = "作成しました!"
|
338
338
|
|
4
createを指摘されたように変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -326,11 +326,13 @@
|
|
326
326
|
|
327
327
|
|
328
328
|
|
329
|
+
#変更
|
330
|
+
|
329
331
|
def create
|
330
332
|
|
331
333
|
@tasks = TaskCollection.new(current_user, tasks_params)
|
332
334
|
|
333
|
-
if @tasks.save
|
335
|
+
if @tasks.each{|task| task.save! }
|
334
336
|
|
335
337
|
flash[:success] = "作成しました!"
|
336
338
|
|
3
エラー画面の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,9 +20,11 @@
|
|
20
20
|
|
21
21
|
![イメージ説明](582faa2c6a7616a59feb9f69ad6dea8a.png)
|
22
22
|
|
23
|
-
|
23
|
+
New!
|
24
|
+
|
24
|
-
|
25
|
+
エラー画面
|
26
|
+
|
25
|
-
|
27
|
+
![イメージ説明](e57ea7624c1017ce11ed6772f93edd85.png)
|
26
28
|
|
27
29
|
app/views/tasks/new.html.erb
|
28
30
|
|
2
エラーログの変更とタイポの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -66,7 +66,7 @@
|
|
66
66
|
|
67
67
|
<% end %>
|
68
68
|
|
69
|
-
<p><%= field.label :content", class: 'label' %></p><br>
|
69
|
+
<p><%= field.label :"content", class: 'label' %></p><br>
|
70
70
|
|
71
71
|
<p><%= field.text_area :content, class: 'tasks-form-area' %></p><br>
|
72
72
|
|
@@ -510,61 +510,49 @@
|
|
510
510
|
|
511
511
|
|
512
512
|
|
513
|
-
Started POST "/tasks" for 172.18.0.1 at 2021-03-12 0
|
514
|
-
|
515
|
-
Processing by TasksController#create as HTML
|
516
|
-
|
517
|
-
Parameters: {"utf8"=>"✓", "authenticity_token"=>
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
(0.
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
(
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
Rendered layouts/_shim.html.erb (0.5ms)
|
558
|
-
|
559
|
-
Rendered layouts/_head.html.erb (444.9ms)
|
560
|
-
|
561
|
-
Rendered layouts/_header.html.erb (1.8ms)
|
562
|
-
|
563
|
-
Rendered layouts/_flash_messages.html.erb (0.7ms)
|
564
|
-
|
565
|
-
Rendered layouts/_footer.html.erb (3.8ms)
|
566
|
-
|
567
|
-
Completed 200 OK in 765ms (Views: 632.8ms | ActiveRecord: 7.2ms)
|
513
|
+
Started POST "/tasks" for 172.18.0.1 at 2021-03-12 08:00:41 +0000
|
514
|
+
|
515
|
+
web_1 | Processing by TasksController#create as HTML
|
516
|
+
|
517
|
+
web_1 | Parameters: {"utf8"=>"✓", "authenticity_token"=>"YGJn1DCr5ZPyJoB9kLvySBof7vj2II4iLb6KQFj+OtXqy0C1bMZ162jmby9s+XZrTcLaHNIz2B4RK39fS7U9Lg==", "tasks"=>[{"title"=>"task0", "priority"=>"0", "content"=>""}, {"title"=>"task1", "priority"=>"1", "content"=>""}, {"title"=>"task2", "priority"=>"2", "content"=>""}], "commit"=>"一括登録"}
|
518
|
+
|
519
|
+
web_1 | User Load (0.6ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 4 LIMIT 1
|
520
|
+
|
521
|
+
web_1 | (0.6ms) BEGIN
|
522
|
+
|
523
|
+
web_1 | User Load (1.6ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 4 LIMIT 1
|
524
|
+
|
525
|
+
web_1 | Task Exists (0.8ms) SELECT 1 AS one FROM `tasks` WHERE `tasks`.`priority` = 0 LIMIT 1
|
526
|
+
|
527
|
+
web_1 | CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 4 LIMIT 1
|
528
|
+
|
529
|
+
web_1 | Task Exists (0.8ms) SELECT 1 AS one FROM `tasks` WHERE `tasks`.`priority` = 1 LIMIT 1
|
530
|
+
|
531
|
+
web_1 | CACHE User Load (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 4 LIMIT 1
|
532
|
+
|
533
|
+
web_1 | Task Exists (3.7ms) SELECT 1 AS one FROM `tasks` WHERE `tasks`.`priority` = 2 LIMIT 1
|
534
|
+
|
535
|
+
web_1 | (0.7ms) ROLLBACK
|
536
|
+
|
537
|
+
web_1 | "エラー"
|
538
|
+
|
539
|
+
web_1 | Rendering tasks/new.html.erb within layouts/application
|
540
|
+
|
541
|
+
web_1 | Rendered tasks/new.html.erb within layouts/application (14.4ms)
|
542
|
+
|
543
|
+
web_1 | Rendered layouts/_shim.html.erb (1.1ms)
|
544
|
+
|
545
|
+
web_1 | Rendered layouts/_head.html.erb (1440.8ms)
|
546
|
+
|
547
|
+
web_1 | Rendered layouts/_header.html.erb (3.3ms)
|
548
|
+
|
549
|
+
web_1 | Rendered layouts/_flash_messages.html.erb (1.3ms)
|
550
|
+
|
551
|
+
web_1 | Rendered layouts/_footer.html.erb (7.9ms)
|
552
|
+
|
553
|
+
web_1 | Completed 200 OK in 2111ms (Views: 1884.7ms | ActiveRecord: 13.0ms)
|
554
|
+
|
555
|
+
|
568
556
|
|
569
557
|
|
570
558
|
|
1
インデントの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -370,7 +370,9 @@
|
|
370
370
|
|
371
371
|
def tasks_params
|
372
372
|
|
373
|
-
params.require(:tasks)
|
373
|
+
params.require(:tasks)
|
374
|
+
|
375
|
+
end
|
374
376
|
|
375
377
|
|
376
378
|
|
@@ -522,7 +524,9 @@
|
|
522
524
|
|
523
525
|
"priority"=>"0", "content"=>""},
|
524
526
|
|
527
|
+
{"title"=>"task1", "priority"=>"1", "content"=>""},
|
528
|
+
|
525
|
-
|
529
|
+
{"title"=>"task2", "priority"=>"2", "content"=>""}],
|
526
530
|
|
527
531
|
"commit"=>"一括登録"}
|
528
532
|
|