質問編集履歴
1
コードの編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -54,11 +54,13 @@
|
|
54
54
|
|
55
55
|
# POST /tasks.json
|
56
56
|
|
57
|
-
|
57
|
+
def create
|
58
58
|
|
59
59
|
id = params[:id]
|
60
60
|
|
61
|
+
|
62
|
+
|
61
|
-
@task = Task.new(
|
63
|
+
@task = Task.new(params[:task])
|
62
64
|
|
63
65
|
@task.user = current_user
|
64
66
|
|
@@ -84,7 +86,7 @@
|
|
84
86
|
|
85
87
|
params.require(:task).permit(
|
86
88
|
|
87
|
-
:due_date,:category)
|
89
|
+
:title, :status, :due_date, :category_id_id)
|
88
90
|
|
89
91
|
end
|
90
92
|
|
@@ -108,9 +110,9 @@
|
|
108
110
|
|
109
111
|
<tr>
|
110
112
|
|
111
|
-
<th><%= form.label :category, "カテゴリー" %></th>
|
113
|
+
<th><%= form.label :category_id_id, "カテゴリー" %></th>
|
112
|
-
|
114
|
+
|
113
|
-
<td><%= form.collection_select :category, Category.all, :id, :category%></td>
|
115
|
+
<td><%= form.collection_select :category_id_id, Category.all, :id, :category%></td>
|
114
116
|
|
115
117
|
</tr>
|
116
118
|
|
@@ -214,7 +216,7 @@
|
|
214
216
|
|
215
217
|
validates :title, presence: true
|
216
218
|
|
217
|
-
validates :category, presence: true
|
219
|
+
validates :category_id_id, presence: true
|
218
220
|
|
219
221
|
validates :status, presence: true
|
220
222
|
|