質問編集履歴
3
エラー文追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -364,23 +364,49 @@
|
|
364
364
|
|
365
365
|
/usr/local/bundle/gems/sorcery-0.15.0/lib/sorcery/adapters/active_record_adapter.rb:38: warning: Using the last argument as keywor
|
366
366
|
|
367
|
-
|
368
|
-
|
369
367
|
d parameters is deprecated; maybe ** should be added to the call
|
370
368
|
|
371
369
|
/usr/local/bundle/gems/activemodel-6.0.3.2/lib/active_model/callbacks.rb:144: warning: The called method is defined here
|
372
370
|
|
373
371
|
rails aborted!
|
374
372
|
|
375
|
-
NoMethodError: undefined method `
|
373
|
+
NoMethodError: undefined method `each' for 5:Integer
|
374
|
+
|
376
|
-
|
375
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/associations/collection_association.rb:245:in `replace'
|
376
|
+
|
377
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/associations/collection_association.rb:41:in `writer'
|
378
|
+
|
379
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/associations/builder/association.rb:108:in `target_years='
|
380
|
+
|
381
|
+
/usr/local/bundle/gems/activemodel-6.0.3.2/lib/active_model/attribute_assignment.rb:50:in `public_send'
|
382
|
+
|
383
|
+
/usr/local/bundle/gems/activemodel-6.0.3.2/lib/active_model/attribute_assignment.rb:50:in `_assign_attribute'
|
384
|
+
|
385
|
+
/usr/local/bundle/gems/activemodel-6.0.3.2/lib/active_model/attribute_assignment.rb:43:in `block in _assign_attributes'
|
386
|
+
|
387
|
+
/usr/local/bundle/gems/activemodel-6.0.3.2/lib/active_model/attribute_assignment.rb:42:in `each'
|
388
|
+
|
389
|
+
/usr/local/bundle/gems/activemodel-6.0.3.2/lib/active_model/attribute_assignment.rb:42:in `_assign_attributes'
|
390
|
+
|
391
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/attribute_assignment.rb:21:in `_assign_attributes'
|
392
|
+
|
393
|
+
/usr/local/bundle/gems/activemodel-6.0.3.2/lib/active_model/attribute_assignment.rb:35:in `assign_attributes'
|
394
|
+
|
395
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/core.rb:325:in `initialize'
|
396
|
+
|
397
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/inheritance.rb:70:in `new'
|
398
|
+
|
399
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/inheritance.rb:70:in `new'
|
400
|
+
|
401
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/persistence.rb:54:in `create!'
|
402
|
+
|
377
|
-
/
|
403
|
+
/my-api/db/seeds.rb:185:in `block in <main>'
|
378
404
|
|
379
405
|
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/relation/delegation.rb:87:in `each'
|
380
406
|
|
381
407
|
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/relation/delegation.rb:87:in `each'
|
382
408
|
|
383
|
-
/
|
409
|
+
/my-api/db/seeds.rb:184:in `<main>'
|
384
410
|
|
385
411
|
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
|
386
412
|
|
@@ -418,27 +444,23 @@
|
|
418
444
|
|
419
445
|
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
|
420
446
|
|
447
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsna
|
448
|
+
|
449
|
+
p_lfi'
|
450
|
+
|
451
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
|
452
|
+
|
453
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
|
454
|
+
|
455
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
|
456
|
+
|
457
|
+
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
|
458
|
+
|
421
459
|
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
|
422
460
|
|
423
|
-
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsna
|
424
|
-
|
425
|
-
p_lfi'
|
426
|
-
|
427
|
-
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
|
428
|
-
|
429
|
-
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
|
434
|
-
|
435
|
-
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
|
436
|
-
|
437
|
-
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
|
438
|
-
|
439
461
|
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require'
|
440
462
|
|
441
|
-
/
|
463
|
+
/my-api/bin/rails:9:in `<top (required)>'
|
442
464
|
|
443
465
|
/usr/local/bundle/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
|
444
466
|
|
@@ -460,8 +482,4 @@
|
|
460
482
|
|
461
483
|
bin/rails:3:in `load'
|
462
484
|
|
463
|
-
bin/rails:3:in `<main>'
|
464
|
-
|
465
|
-
Tasks: TOP => db:seed
|
466
|
-
|
467
|
-
```
|
485
|
+
```
|
2
エラー文追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -349,3 +349,119 @@
|
|
349
349
|
end
|
350
350
|
|
351
351
|
```
|
352
|
+
|
353
|
+
エラー文全文です。
|
354
|
+
|
355
|
+
```
|
356
|
+
|
357
|
+
/usr/local/bundle/gems/acts_as_paranoid-0.6.3/lib/acts_as_paranoid/associations.rb:19: warning: Using the last argument as keyword
|
358
|
+
|
359
|
+
parameters is deprecated; maybe ** should be added to the call
|
360
|
+
|
361
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/associations.rb:1657: warning: The called method `belongs_to_without
|
362
|
+
|
363
|
+
_deleted' is defined here
|
364
|
+
|
365
|
+
/usr/local/bundle/gems/sorcery-0.15.0/lib/sorcery/adapters/active_record_adapter.rb:38: warning: Using the last argument as keywor
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
d parameters is deprecated; maybe ** should be added to the call
|
370
|
+
|
371
|
+
/usr/local/bundle/gems/activemodel-6.0.3.2/lib/active_model/callbacks.rb:144: warning: The called method is defined here
|
372
|
+
|
373
|
+
rails aborted!
|
374
|
+
|
375
|
+
NoMethodError: undefined method `id' for nil:NilClass
|
376
|
+
|
377
|
+
/leasy-api/db/seeds.rb:190:in `block in <main>'
|
378
|
+
|
379
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/relation/delegation.rb:87:in `each'
|
380
|
+
|
381
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/relation/delegation.rb:87:in `each'
|
382
|
+
|
383
|
+
/leasy-api/db/seeds.rb:184:in `<main>'
|
384
|
+
|
385
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
|
386
|
+
|
387
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
|
388
|
+
|
389
|
+
/usr/local/bundle/gems/railties-6.0.3.2/lib/rails/engine.rb:557:in `block in load_seed'
|
390
|
+
|
391
|
+
/usr/local/bundle/gems/railties-6.0.3.2/lib/rails/engine.rb:675:in `with_inline_jobs'
|
392
|
+
|
393
|
+
/usr/local/bundle/gems/railties-6.0.3.2/lib/rails/engine.rb:557:in `load_seed'
|
394
|
+
|
395
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/tasks/database_tasks.rb:440:in `load_seed'
|
396
|
+
|
397
|
+
/usr/local/bundle/gems/activerecord-6.0.3.2/lib/active_record/railties/databases.rake:331:in `block (2 levels) in <main>'
|
398
|
+
|
399
|
+
/usr/local/bundle/gems/railties-6.0.3.2/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
|
400
|
+
|
401
|
+
/usr/local/bundle/gems/railties-6.0.3.2/lib/rails/commands/rake/rake_command.rb:20:in `perform'
|
402
|
+
|
403
|
+
/usr/local/bundle/gems/railties-6.0.3.2/lib/rails/command.rb:48:in `invoke'
|
404
|
+
|
405
|
+
/usr/local/bundle/gems/railties-6.0.3.2/lib/rails/commands.rb:18:in `<main>'
|
406
|
+
|
407
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
|
408
|
+
|
409
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsna
|
410
|
+
|
411
|
+
p_lfi'
|
412
|
+
|
413
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
|
414
|
+
|
415
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
|
416
|
+
|
417
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
|
418
|
+
|
419
|
+
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
|
420
|
+
|
421
|
+
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
|
422
|
+
|
423
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsna
|
424
|
+
|
425
|
+
p_lfi'
|
426
|
+
|
427
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
|
428
|
+
|
429
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
|
434
|
+
|
435
|
+
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
|
436
|
+
|
437
|
+
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
|
438
|
+
|
439
|
+
/usr/local/bundle/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require'
|
440
|
+
|
441
|
+
/leasy-api/bin/rails:9:in `<top (required)>'
|
442
|
+
|
443
|
+
/usr/local/bundle/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
|
444
|
+
|
445
|
+
/usr/local/bundle/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
|
446
|
+
|
447
|
+
/usr/local/bundle/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
|
448
|
+
|
449
|
+
/usr/local/bundle/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
|
450
|
+
|
451
|
+
/usr/local/bundle/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
|
452
|
+
|
453
|
+
/usr/local/bundle/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
|
454
|
+
|
455
|
+
/usr/local/bundle/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
|
456
|
+
|
457
|
+
/my-api/bin/spring:15:in `require'
|
458
|
+
|
459
|
+
/my-api/bin/spring:15:in `<top (required)>'
|
460
|
+
|
461
|
+
bin/rails:3:in `load'
|
462
|
+
|
463
|
+
bin/rails:3:in `<main>'
|
464
|
+
|
465
|
+
Tasks: TOP => db:seed
|
466
|
+
|
467
|
+
```
|
1
最初投稿したseedファイルを入れて現在記載しているものを載せました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -73,3 +73,279 @@
|
|
73
73
|
|
74
74
|
|
75
75
|
eachのエラーから5個も繰り返せる配列がないとのエラーだと思い、5.timesの記載を消して試してみましたが、解決できませんでした。何か対処法あれば教えて頂きたいです。
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
```seed
|
80
|
+
|
81
|
+
require 'csv'
|
82
|
+
|
83
|
+
require 'securerandom'
|
84
|
+
|
85
|
+
##master系CSVの読み込み
|
86
|
+
|
87
|
+
#category
|
88
|
+
|
89
|
+
CSV.foreach("db/csv/masters/init_categories.csv") do |row|
|
90
|
+
|
91
|
+
@category = Masters::Category.create!(name: row[0])
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
#tag
|
98
|
+
|
99
|
+
CSV.foreach("db/csv/masters/init_tags.csv") do |row|
|
100
|
+
|
101
|
+
@tag = Masters::Tag.create!(name: row[0])
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
#year
|
108
|
+
|
109
|
+
CSV.foreach("db/csv/masters/init_years.csv") do |row|
|
110
|
+
|
111
|
+
@year = Masters::Year.create!(name: row[0])
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
## Master系以外
|
118
|
+
|
119
|
+
#admin user active
|
120
|
+
|
121
|
+
adminuser = User.create!(
|
122
|
+
|
123
|
+
email: "test@admin.com",
|
124
|
+
|
125
|
+
password: "password",
|
126
|
+
|
127
|
+
user_type: 1,
|
128
|
+
|
129
|
+
status: 1 )
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
#user
|
134
|
+
|
135
|
+
10.times do |n|
|
136
|
+
|
137
|
+
@user = User.create!(
|
138
|
+
|
139
|
+
email: "user#{n+1}@example.com",
|
140
|
+
|
141
|
+
password: "password",
|
142
|
+
|
143
|
+
user_type: 0,
|
144
|
+
|
145
|
+
status: 0 )
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
#line_profile
|
152
|
+
|
153
|
+
User.all.each_with_index do |user,idx|
|
154
|
+
|
155
|
+
line_profile = LineProfile.create!(
|
156
|
+
|
157
|
+
user_id: user.id,
|
158
|
+
|
159
|
+
line_id: "@testline#{idx+1}" )
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
#profile
|
166
|
+
|
167
|
+
10.times do |n|
|
168
|
+
|
169
|
+
@profile = Profile.create!(
|
170
|
+
|
171
|
+
user_id: Random.rand(10) + 1,
|
172
|
+
|
173
|
+
name: "山田太郎",
|
174
|
+
|
175
|
+
phonetic: "やまだたろう",
|
176
|
+
|
177
|
+
phone_number: "09000000000",
|
178
|
+
|
179
|
+
postal_code: "123-1234",
|
180
|
+
|
181
|
+
address: "東京都中央区XXX-XXXXXXXX" )
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
#item_topic
|
188
|
+
|
189
|
+
10.times do |n|
|
190
|
+
|
191
|
+
@item_topic = ItemTopic.create!(
|
192
|
+
|
193
|
+
thumbnail: open("db/images/sample.png"),
|
194
|
+
|
195
|
+
title: "商品トピック#{n+1}",
|
196
|
+
|
197
|
+
overview: "概要#{n+1}",
|
198
|
+
|
199
|
+
link: "http://origin_item_topic_sample.com",
|
200
|
+
|
201
|
+
status: rand(0..1) )
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
#favorites
|
208
|
+
|
209
|
+
10.times do
|
210
|
+
|
211
|
+
favorite = Favorite.create!(
|
212
|
+
|
213
|
+
user_id: Random.rand(10) + 1,
|
214
|
+
|
215
|
+
job_topic_id: Random.rand(10) + 1 )
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
#item_topic_tag
|
222
|
+
|
223
|
+
10.times do
|
224
|
+
|
225
|
+
ItemTopicTag.create!(tag_id: @tag.id, job_topic_id: @item_topic.id)
|
226
|
+
|
227
|
+
end
|
228
|
+
|
229
|
+
#item_topic_category
|
230
|
+
|
231
|
+
item_topic_category = JobTopicCategory.create!(job_topic_id: @item_topic.id, category_id: @category.id)
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
#item_event
|
236
|
+
|
237
|
+
10.times do |n|
|
238
|
+
|
239
|
+
@item_event = ItemEvent.create!(
|
240
|
+
|
241
|
+
title: "商品説明会#{n+1}",
|
242
|
+
|
243
|
+
link: "http://example#{n+1}.com",
|
244
|
+
|
245
|
+
image: open("db/images/sample.png"),
|
246
|
+
|
247
|
+
color: "blue",
|
248
|
+
|
249
|
+
start_date: "2020/5/1",
|
250
|
+
|
251
|
+
end_date: "2020/5/30",
|
252
|
+
|
253
|
+
status: rand(0..1) )
|
254
|
+
|
255
|
+
end
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
#item_site
|
260
|
+
|
261
|
+
10.times do |n|
|
262
|
+
|
263
|
+
@item_site = ItemSite.create!(
|
264
|
+
|
265
|
+
thumbnail: open("db/images/sample.png"),
|
266
|
+
|
267
|
+
logo: open("db/images/sample.png"),
|
268
|
+
|
269
|
+
image: open("db/images/sample.png"),
|
270
|
+
|
271
|
+
description: "説明#{n+1}",
|
272
|
+
|
273
|
+
title: "商品サービス#{n+1}",
|
274
|
+
|
275
|
+
overview: "概要#{n+1}",
|
276
|
+
|
277
|
+
link: "http://origin_item_site_sample.com" )
|
278
|
+
|
279
|
+
end
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
#item_site_tqg
|
284
|
+
|
285
|
+
item_site_tag = ItemSiteTag.create!(item_site_id: @item_site.id, tag_id: @tag.id)
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
#item_site_review
|
290
|
+
|
291
|
+
10.times do |n|
|
292
|
+
|
293
|
+
@item_site_review = ItemSiteReview.create!(
|
294
|
+
|
295
|
+
item_site_id: @item_site.id,
|
296
|
+
|
297
|
+
thumbnail: open("db/images/sample.png"),
|
298
|
+
|
299
|
+
title: "最高でした",
|
300
|
+
|
301
|
+
link: "http://examplereview#{n}.com" )
|
302
|
+
|
303
|
+
end
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
#item_site_category
|
308
|
+
|
309
|
+
item_site_category = ItemSiteCategory.create!(item_site_id: @item_site.id, category_id: @category.id)
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
#item_group
|
314
|
+
|
315
|
+
5.times do |n|
|
316
|
+
|
317
|
+
@item_group = ItemGroup.create!(
|
318
|
+
|
319
|
+
category_id: @category.id,
|
320
|
+
|
321
|
+
icon: open("db/images/sample.png"),
|
322
|
+
|
323
|
+
start_date: "2020/5/1",
|
324
|
+
|
325
|
+
end_date: "2020/5/30",
|
326
|
+
|
327
|
+
title: "チュートリアル#{n+1}",
|
328
|
+
|
329
|
+
overview: "アイテム購入について",
|
330
|
+
|
331
|
+
status: rand(0..1) )
|
332
|
+
|
333
|
+
end
|
334
|
+
|
335
|
+
#origin_item
|
336
|
+
|
337
|
+
5.times do |n|
|
338
|
+
|
339
|
+
@origin_item = OriginItem.create!(
|
340
|
+
|
341
|
+
item_group_id: @item_group.id,
|
342
|
+
|
343
|
+
title: "サンプルアイテム#{n+1}",
|
344
|
+
|
345
|
+
overview: "アイテム#{n+1}",
|
346
|
+
|
347
|
+
status: rand(0..1) )
|
348
|
+
|
349
|
+
end
|
350
|
+
|
351
|
+
```
|