質問編集履歴
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,7 +42,13 @@
|
|
42
42
|
|
43
43
|
# 返信
|
44
44
|
|
45
|
-
has_many :replies, class_name: 'Comment', foreign_key: :reply, dependent: :destroy
|
45
|
+
has_many :replies, class_name: 'Comment', foreign_key: :reply_id, dependent: :destroy
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
# reply_idがnilなら親コメント
|
50
|
+
|
51
|
+
scope :parent_comment, -> { where(reply_id: nil) }
|
46
52
|
|
47
53
|
```
|
48
54
|
|