質問編集履歴

2

追加

2021/05/21 07:18

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -214,6 +214,36 @@
214
214
 
215
215
 
216
216
 
217
+ ```tasksRB
218
+
219
+ class Task < ApplicationRecord
220
+
221
+ belongs_to :project
222
+
223
+ validates :title, presence: true
224
+
225
+ validates :status, presence: true
226
+
227
+ enum status: { todo: 0, doing: 1, done: 2 }
228
+
229
+
230
+
231
+ after_update :insert_complete_date
232
+
233
+
234
+
235
+ def insert_complete_date
236
+
237
+ update(completion_date: Time.current) if done? && completion_date.blank?
238
+
239
+ end
240
+
241
+ end
242
+
243
+ ```
244
+
245
+
246
+
217
247
  ```route
218
248
 
219
249
  Rails.application.routes.draw do

1

文字の修正

2021/05/21 07:18

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- Rails ActiveRecord::RecordNotFound
1
+ Rails ActiveRecord::RecordNotFoundのエラーが解決できない
test CHANGED
File without changes