質問編集履歴
1
モデルを記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -85,3 +85,55 @@
|
|
85
85
|
50箱
|
86
86
|
|
87
87
|
```
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
## user.rb
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
|
95
|
+
has_many :mask_users
|
96
|
+
|
97
|
+
has_many :masks, through: :mask_users
|
98
|
+
|
99
|
+
validates :name, :address, :phone, presence: true, uniqueness: true
|
100
|
+
|
101
|
+
```
|
102
|
+
|
103
|
+
## mask.rb
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
|
107
|
+
has_many :mask_users
|
108
|
+
|
109
|
+
has_many :mask_sizes
|
110
|
+
|
111
|
+
has_many :mask_makers
|
112
|
+
|
113
|
+
has_many :mask_stocks
|
114
|
+
|
115
|
+
has_many :mask_prices
|
116
|
+
|
117
|
+
has_many :users, through: :mask_users
|
118
|
+
|
119
|
+
has_many :sizes, through: :mask_sizes
|
120
|
+
|
121
|
+
has_many :makers, through: :mask_makers
|
122
|
+
|
123
|
+
has_many :stocks, through: :mask_stocks
|
124
|
+
|
125
|
+
has_many :prices, through: :mask_prices
|
126
|
+
|
127
|
+
```
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
## maker.rb
|
132
|
+
|
133
|
+
```
|
134
|
+
|
135
|
+
has_many :mask_makers
|
136
|
+
|
137
|
+
has_many :masks, through: :mask_makers
|
138
|
+
|
139
|
+
```
|