質問編集履歴
1
わかりやすくするため。
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,3 +15,375 @@
|
|
15
15
|
この九つの箱にseed_fuで作ったデータを入れる場合どのようにすればいいでしょうか。
|
16
16
|
|
17
17
|
分かるかたがいれば教えていただけると嬉しいでお願いします。
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
ここに該当するview,controller、migrationを載せときます。モデルはまだ何も記述はしていません。
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
view
|
26
|
+
|
27
|
+
```ここに言語を入力
|
28
|
+
|
29
|
+
.Header-part
|
30
|
+
|
31
|
+
.Icons
|
32
|
+
|
33
|
+
.Icons__icon
|
34
|
+
|
35
|
+
.Icons__icon--user
|
36
|
+
|
37
|
+
= link_to "#" do
|
38
|
+
|
39
|
+
= icon('fas', 'user')
|
40
|
+
|
41
|
+
.Icons__icon
|
42
|
+
|
43
|
+
.Icons__icon--cart
|
44
|
+
|
45
|
+
= link_to "#" do
|
46
|
+
|
47
|
+
= icon('fas', 'cart-plus')
|
48
|
+
|
49
|
+
.Icons__icon
|
50
|
+
|
51
|
+
.Icons__icon--heart
|
52
|
+
|
53
|
+
= icon('fas', 'heart')
|
54
|
+
|
55
|
+
.Header-part__contents
|
56
|
+
|
57
|
+
.Header-part__contents__top
|
58
|
+
|
59
|
+
.Header-part__contents__top_text
|
60
|
+
|
61
|
+
%h1.Header-part__contents__top__icon
|
62
|
+
|
63
|
+
= link_to "#", class: 'Header__contents__top__icon__logo' do
|
64
|
+
|
65
|
+
= image_tag "rental2.png", alt: "logo", width: '120', class: 'Header__contents__top__icon__logo__img'
|
66
|
+
|
67
|
+
.Header-part__contents__top__search
|
68
|
+
|
69
|
+
%form.Header-part__contents__top__search__form
|
70
|
+
|
71
|
+
%input.Header-part__contents__top__search__form__box{"placeholder": "キーワードから探す", "type": "text"}
|
72
|
+
|
73
|
+
%button.Header-part__contents__top__search__form__btn
|
74
|
+
|
75
|
+
= image_tag 'icon-search1.png', class: "Header-part__contents__top__search__form__btn__icon-image"
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
.clothes__product
|
82
|
+
|
83
|
+
%h2.clothes__product__title
|
84
|
+
|
85
|
+
men's
|
86
|
+
|
87
|
+
.clothes__product--lists
|
88
|
+
|
89
|
+
.clothes__product--lists__list
|
90
|
+
|
91
|
+
= link_to "#",class: "image_tag" do
|
92
|
+
|
93
|
+
.clothes__product__images
|
94
|
+
|
95
|
+
= image_tag "rental.png", class: "clothes__product__images"
|
96
|
+
|
97
|
+
.clothes__product--lists__list__body
|
98
|
+
|
99
|
+
%h3.clothes__product--name
|
100
|
+
|
101
|
+
テスト
|
102
|
+
|
103
|
+
%ul.clothes__product__details__menu
|
104
|
+
|
105
|
+
%li 10000円 (税込)
|
106
|
+
|
107
|
+
%li
|
108
|
+
|
109
|
+
%i.fa.fa-star.likeIcon
|
110
|
+
|
111
|
+
1
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
.clothes__product--lists__list
|
118
|
+
|
119
|
+
= link_to "#" ,class: "image_tag" do
|
120
|
+
|
121
|
+
.clothes__product__images
|
122
|
+
|
123
|
+
= image_tag "rental.png", class: "clothes__product__images"
|
124
|
+
|
125
|
+
.clothes__product--lists__list__body
|
126
|
+
|
127
|
+
%h3.clothes__product--name
|
128
|
+
|
129
|
+
テスト
|
130
|
+
|
131
|
+
%ul.clothes__product__details__menu
|
132
|
+
|
133
|
+
%li 10000円 (税込)
|
134
|
+
|
135
|
+
%li
|
136
|
+
|
137
|
+
%i.fa.fa-star.likeIcon
|
138
|
+
|
139
|
+
1
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
.clothes__product--lists__list
|
146
|
+
|
147
|
+
= link_to "#" ,class: "image_tag" do
|
148
|
+
|
149
|
+
.clothes__product__images
|
150
|
+
|
151
|
+
= image_tag "rental.png", class: "clothes__product__images"
|
152
|
+
|
153
|
+
.clothes__product--lists__list__body
|
154
|
+
|
155
|
+
%h3.clothes__product--name
|
156
|
+
|
157
|
+
テスト
|
158
|
+
|
159
|
+
%ul.clothes__product__details__menu
|
160
|
+
|
161
|
+
%li 10000円 (税込)
|
162
|
+
|
163
|
+
%li
|
164
|
+
|
165
|
+
%i.fa.fa-star.likeIcon
|
166
|
+
|
167
|
+
1
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
.clothes__product--lists
|
172
|
+
|
173
|
+
.clothes__product--lists__list
|
174
|
+
|
175
|
+
= link_to "#" ,class: "image_tag" do
|
176
|
+
|
177
|
+
.clothes__product__images
|
178
|
+
|
179
|
+
= image_tag "rental.png", class: "clothes__product__images"
|
180
|
+
|
181
|
+
.clothes__product--lists__list__body
|
182
|
+
|
183
|
+
%h3.clothes__product--name
|
184
|
+
|
185
|
+
テスト
|
186
|
+
|
187
|
+
%ul.clothes__product__details__menu
|
188
|
+
|
189
|
+
%li 10000円 (税込)
|
190
|
+
|
191
|
+
%li
|
192
|
+
|
193
|
+
%i.fa.fa-star.likeIcon
|
194
|
+
|
195
|
+
1
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
.clothes__product--lists__list
|
202
|
+
|
203
|
+
= link_to "#" ,class: "image_tag" do
|
204
|
+
|
205
|
+
.clothes__product__images
|
206
|
+
|
207
|
+
= image_tag "rental.png", class: "clothes__product__images"
|
208
|
+
|
209
|
+
.clothes__product--lists__list__body
|
210
|
+
|
211
|
+
%h3.clothes__product--name
|
212
|
+
|
213
|
+
テスト
|
214
|
+
|
215
|
+
%ul.clothes__product__details__menu
|
216
|
+
|
217
|
+
%li 10000円 (税込)
|
218
|
+
|
219
|
+
%li
|
220
|
+
|
221
|
+
%i.fa.fa-star.likeIcon
|
222
|
+
|
223
|
+
1
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
.clothes__product--lists__list
|
230
|
+
|
231
|
+
= link_to "#" ,class: "image_tag" do
|
232
|
+
|
233
|
+
.clothes__product__images
|
234
|
+
|
235
|
+
= image_tag "rental.png", class: "clothes__product__images"
|
236
|
+
|
237
|
+
.clothes__product--lists__list__body
|
238
|
+
|
239
|
+
%h3.clothes__product--name
|
240
|
+
|
241
|
+
テスト
|
242
|
+
|
243
|
+
%ul.clothes__product__details__menu
|
244
|
+
|
245
|
+
%li 10000円 (税込)
|
246
|
+
|
247
|
+
%li
|
248
|
+
|
249
|
+
%i.fa.fa-star.likeIcon
|
250
|
+
|
251
|
+
1
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
.clothes__product--lists
|
258
|
+
|
259
|
+
.clothes__product--lists__list
|
260
|
+
|
261
|
+
= link_to "#" ,class: "image_tag" do
|
262
|
+
|
263
|
+
.clothes__product__images
|
264
|
+
|
265
|
+
= image_tag "rental.png", class: "clothes__product__images"
|
266
|
+
|
267
|
+
.clothes__product--lists__list__body
|
268
|
+
|
269
|
+
%h3.clothes__product--name
|
270
|
+
|
271
|
+
テスト
|
272
|
+
|
273
|
+
%ul.clothes__product__details__menu
|
274
|
+
|
275
|
+
%li 10000円 (税込)
|
276
|
+
|
277
|
+
%li
|
278
|
+
|
279
|
+
%i.fa.fa-star.likeIcon
|
280
|
+
|
281
|
+
1
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
.clothes__product--lists__list
|
288
|
+
|
289
|
+
= link_to "#" ,class: "image_tag" do
|
290
|
+
|
291
|
+
.clothes__product__images
|
292
|
+
|
293
|
+
= image_tag "rental.png", class: "clothes__product__images"
|
294
|
+
|
295
|
+
.clothes__product--lists__list__body
|
296
|
+
|
297
|
+
%h3.clothes__product--name
|
298
|
+
|
299
|
+
テスト
|
300
|
+
|
301
|
+
%ul.clothes__product__details__menu
|
302
|
+
|
303
|
+
%li 10000円 (税込)
|
304
|
+
|
305
|
+
%li
|
306
|
+
|
307
|
+
%i.fa.fa-star.likeIcon
|
308
|
+
|
309
|
+
1
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
.clothes__product--lists__list
|
316
|
+
|
317
|
+
= link_to "#" ,class: "image_tag" do
|
318
|
+
|
319
|
+
.clothes__product__images
|
320
|
+
|
321
|
+
= image_tag "rental.png", class: "clothes__product__images"
|
322
|
+
|
323
|
+
.clothes__product--lists__list__body
|
324
|
+
|
325
|
+
%h3.clothes__product--name
|
326
|
+
|
327
|
+
テスト
|
328
|
+
|
329
|
+
%ul.clothes__product__details__menu
|
330
|
+
|
331
|
+
%li 10000円 (税込)
|
332
|
+
|
333
|
+
%li
|
334
|
+
|
335
|
+
%i.fa.fa-star.likeIcon
|
336
|
+
|
337
|
+
1
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
```
|
342
|
+
|
343
|
+
controller
|
344
|
+
|
345
|
+
```ここに言語を入力
|
346
|
+
|
347
|
+
class MensController < ApplicationController
|
348
|
+
|
349
|
+
def index
|
350
|
+
|
351
|
+
@item = Item.all
|
352
|
+
|
353
|
+
end
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
end
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
```
|
362
|
+
|
363
|
+
マイグレーション
|
364
|
+
|
365
|
+
```ここに言語を入力
|
366
|
+
|
367
|
+
class CreateItems < ActiveRecord::Migration[6.0]
|
368
|
+
|
369
|
+
def change
|
370
|
+
|
371
|
+
create_table :items do |t|
|
372
|
+
|
373
|
+
t.string :name
|
374
|
+
|
375
|
+
t.string :item_id, null: false
|
376
|
+
|
377
|
+
t.timestamps
|
378
|
+
|
379
|
+
end
|
380
|
+
|
381
|
+
add_index :items, :item_id, unique: true
|
382
|
+
|
383
|
+
end
|
384
|
+
|
385
|
+
end
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
```
|