blob: 010526028826437ba8ba62aafb2b3c8b1fb93bf5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
BEDS = 14
RAFTS = 10
1.upto(BEDS) do |b|
bed = Bed.find_or_create_by!(location: b)
crop_name = case b
when 1..2 then "tomatoes"
when 3 then "hot peppers"
when 4 then "chives"
when 5 then "italian basil"
when 6..7 then "chinese cabbage"
else "lettuce"
end
1.upto(RAFTS) do |r|
raft = bed.rafts.find_or_create_by!(location: r) do |raft|
raft.crop = Crop.find_by!(name: crop_name)
end
end
end
puts "Beds: #{Bed.count}"
puts "Rafts: #{Raft.count}"
|