質問編集履歴
2
詳細な文章の掲載
title
CHANGED
File without changes
|
body
CHANGED
@@ -21,4 +21,20 @@
|
|
21
21
|
|
22
22
|
|
23
23
|
現在のやり方だと、変数の中身を見てみると毎回whereの中身が [] になってしまいます。
|
24
|
-
宜しくお願いします。
|
24
|
+
宜しくお願いします。
|
25
|
+
|
26
|
+
```item
|
27
|
+
has_many :categories_items
|
28
|
+
has_many :categories, through: :categories_items
|
29
|
+
accepts_nested_attributes_for :categories_items
|
30
|
+
```
|
31
|
+
|
32
|
+
```categoryitem
|
33
|
+
belongs_to :item, optional: true
|
34
|
+
belongs_to :category, optional: true
|
35
|
+
```
|
36
|
+
|
37
|
+
```category
|
38
|
+
has_many :categories_items
|
39
|
+
has_many :categories, through: :categories_items
|
40
|
+
```
|
1
文章の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
updated_at: Mon, 25 May 2020 02:34:19 UTC +00:00>
|
18
18
|
```
|
19
19
|
small_category_idの中身の[0,15,30,35]をCategoryテーブルでwhereをかけて
|
20
|
-
|
20
|
+
Categoryテーブルから情報を持ってきたい。
|
21
21
|
|
22
22
|
|
23
23
|
現在のやり方だと、変数の中身を見てみると毎回whereの中身が [] になってしまいます。
|