質問編集履歴

1

コントローラー、モデル、マイグレーションファイルの加筆

2020/11/11 01:24

投稿

zoomer
zoomer

スコア1

test CHANGED
File without changes
test CHANGED
@@ -90,7 +90,7 @@
90
90
 
91
91
  ```controler
92
92
 
93
- #GroupsController
93
+ #Groupsのコントローラー
94
94
 
95
95
  class GroupsController < ApplicationController
96
96
 
@@ -152,7 +152,7 @@
152
152
 
153
153
  ```view
154
154
 
155
- #views/groups/new.html.erb
155
+ #groups/new.html.erbのview
156
156
 
157
157
 
158
158
 
@@ -294,7 +294,7 @@
294
294
 
295
295
  ```model
296
296
 
297
- #GroupModel
297
+ #Groupモデル
298
298
 
299
299
 
300
300
 
@@ -304,9 +304,9 @@
304
304
 
305
305
 
306
306
 
307
- belongs_to :category
307
+ has_one :category
308
-
308
+
309
- belongs_to :genre
309
+ has_one :genre
310
310
 
311
311
 
312
312
 
@@ -314,8 +314,6 @@
314
314
 
315
315
  has_many :users, through: :group_users, dependent: :destroy
316
316
 
317
- # accepts_nested_attributes_for :group_users
318
-
319
317
  has_many :messages, dependent: :destroy
320
318
 
321
319
 
@@ -356,7 +354,7 @@
356
354
 
357
355
  ```model
358
356
 
359
- #UserModel
357
+ #Userモデル
360
358
 
361
359
 
362
360
 
@@ -424,7 +422,7 @@
424
422
 
425
423
  ```model
426
424
 
427
- #GroupUserModel
425
+ #GroupUserモデル
428
426
 
429
427
 
430
428
 
@@ -442,7 +440,7 @@
442
440
 
443
441
  ```migration
444
442
 
445
- #GroupUsers
443
+ #GroupUsersのマイグレーションファイル
446
444
 
447
445
 
448
446
 
@@ -470,7 +468,7 @@
470
468
 
471
469
  ```migration
472
470
 
473
- #Group
471
+ #Groupのマイグレーションファイル
474
472
 
475
473
 
476
474
 
@@ -488,6 +486,8 @@
488
486
 
489
487
  t.integer :genre_id, null: false
490
488
 
489
+ t.references :user, foreign_key: true
490
+
491
491
  t.timestamps
492
492
 
493
493
  end
@@ -504,7 +504,7 @@
504
504
 
505
505
  ```migration
506
506
 
507
- #userの関係のある部分
507
+ #userの関係のある部分のマイグレーションファイル
508
508
 
509
509
 
510
510