質問編集履歴

2

詳細な文章の掲載

2020/05/25 06:42

投稿

Masashige1005
Masashige1005

スコア14

test CHANGED
File without changes
test CHANGED
@@ -45,3 +45,35 @@
45
45
  現在のやり方だと、変数の中身を見てみると毎回whereの中身が [] になってしまいます。
46
46
 
47
47
  宜しくお願いします。
48
+
49
+
50
+
51
+ ```item
52
+
53
+ has_many :categories_items
54
+
55
+ has_many :categories, through: :categories_items
56
+
57
+ accepts_nested_attributes_for :categories_items
58
+
59
+ ```
60
+
61
+
62
+
63
+ ```categoryitem
64
+
65
+ belongs_to :item, optional: true
66
+
67
+ belongs_to :category, optional: true
68
+
69
+ ```
70
+
71
+
72
+
73
+ ```category
74
+
75
+ has_many :categories_items
76
+
77
+ has_many :categories, through: :categories_items
78
+
79
+ ```

1

文章の修正

2020/05/25 06:42

投稿

Masashige1005
Masashige1005

スコア14

test CHANGED
File without changes
test CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
  small_category_idの中身の[0,15,30,35]をCategoryテーブルでwhereをかけて
38
38
 
39
- テーブルから情報を持ってきたい。
39
+ Categoryテーブルから情報を持ってきたい。
40
40
 
41
41
 
42
42