質問編集履歴
1
ReplyのDBを付け加えました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -132,4 +132,18 @@
|
|
132
132
|
belongs_to :title, class_name: 'Task'
|
133
133
|
belongs_to :user
|
134
134
|
end
|
135
|
+
```
|
136
|
+
class Reply のDBです
|
137
|
+
```Rails
|
138
|
+
class CreateReplies < ActiveRecord::Migration[5.2]
|
139
|
+
def change
|
140
|
+
create_table :replies do |t|
|
141
|
+
t.references :title, foreign_key: { to_table: :tasks }
|
142
|
+
t.references :user, foreign_key: true
|
143
|
+
t.string :comment
|
144
|
+
|
145
|
+
t.timestamps
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
135
149
|
```
|