質問編集履歴
1
成功のコード追加と修正を行いました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
line = human.line.where(id: messages_ids)
|
30
30
|
|
31
|
-
kidoku = line.kidoku_messages.find_or_initialize_by(user_id: user)
|
31
|
+
kidoku = line.kidoku_messages.find_or_initialize_by(line_id: message_ids, user_id: user)
|
32
32
|
|
33
33
|
kidoku.read_time = Time.now
|
34
34
|
|
@@ -54,6 +54,24 @@
|
|
54
54
|
|
55
55
|
|
56
56
|
|
57
|
+
```
|
58
|
+
|
59
|
+
def update
|
60
|
+
|
61
|
+
line = human.line.find_by!(id: messages_id)
|
62
|
+
|
63
|
+
kid = line.kidoku_messages.find_or_initialize_by(line_id: message_id, user_id: user)
|
64
|
+
|
65
|
+
kid.read_time = Time.now
|
66
|
+
|
67
|
+
kid.save!
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
|
57
75
|
以下のようにeachを使った場合はread_timeがないと言われてしまい処理が最後まで走りません。
|
58
76
|
|
59
77
|
|
@@ -66,7 +84,7 @@
|
|
66
84
|
|
67
85
|
line.each do |kidoku|
|
68
86
|
|
69
|
-
kid = kidoku.kidoku_messages.find_or_initialize_by(line_id:
|
87
|
+
kid = kidoku.kidoku_messages.find_or_initialize_by(line_id: message_ids, user_id: user)
|
70
88
|
|
71
89
|
kid.read_time = Time.now
|
72
90
|
|