質問編集履歴
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -285,3 +285,53 @@
|
|
285
285
|
|
286
286
|
|
287
287
|
![イメージ説明](2984a1284bfa6481602428cae4985e37.png)
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
```ruby
|
296
|
+
|
297
|
+
#user.rb
|
298
|
+
|
299
|
+
class User < ApplicationRecord
|
300
|
+
|
301
|
+
has_many :schedules, dependent: :destroy
|
302
|
+
|
303
|
+
accepts_nested_attributes_for :schedules, allow_destroy: true
|
304
|
+
|
305
|
+
end
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
```
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
```ruby
|
314
|
+
|
315
|
+
#schedule.rb
|
316
|
+
|
317
|
+
class Schedule < ApplicationRecord
|
318
|
+
|
319
|
+
belongs_to :user
|
320
|
+
|
321
|
+
end
|
322
|
+
|
323
|
+
```
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
```ruby
|
328
|
+
|
329
|
+
#category.rb
|
330
|
+
|
331
|
+
class Category < ApplicationRecord
|
332
|
+
|
333
|
+
end
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
```
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
親:User テーブル (company,userid,pass,memo)
|
8
8
|
|
9
|
-
子:Schedule テーブル (time
|
9
|
+
子:Schedule テーブル (time,user_id,category_id)
|
10
10
|
|
11
11
|
Category テーブル (category)
|
12
12
|
|
@@ -14,6 +14,10 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
17
21
|
```ruby
|
18
22
|
|
19
23
|
#_form.html.erb
|
@@ -278,4 +282,6 @@
|
|
278
282
|
|
279
283
|
|
280
284
|
|
285
|
+
|
286
|
+
|
281
287
|
![イメージ説明](2984a1284bfa6481602428cae4985e37.png)
|