質問編集履歴
1
item.rbを追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -19,4 +19,27 @@
|
|
19
19
|
NameError in ItemsController#destroy
|
20
20
|
uninitialized constant Item::Comment
|
21
21
|
エラーが発生している
|
22
|
-
https://gyazo.com/ba122a8ccf0df93a231ec2074091ee21
|
22
|
+
https://gyazo.com/ba122a8ccf0df93a231ec2074091ee21
|
23
|
+
|
24
|
+
#item.rb
|
25
|
+
```ここに言語を入力
|
26
|
+
class Item < ApplicationRecord
|
27
|
+
has_many :item_images, dependent: :destroy
|
28
|
+
accepts_nested_attributes_for :item_images, allow_destroy: true
|
29
|
+
|
30
|
+
has_many :comments, dependent: :destroy
|
31
|
+
has_many :favorites, dependent: :destroy
|
32
|
+
|
33
|
+
belongs_to :category
|
34
|
+
belongs_to :brand, optional: true
|
35
|
+
|
36
|
+
belongs_to :seller_item, class_name:"User", optional: true
|
37
|
+
belongs_to :buyer_item, class_name:"User", optional: true
|
38
|
+
|
39
|
+
extend ActiveHash::Associations::ActiveRecordExtensions
|
40
|
+
belongs_to :prefecture, dependent: :destroy
|
41
|
+
belongs_to :brand, dependent: :destroy
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
```
|