diff options
Diffstat (limited to 'db/seeds.rb')
-rw-r--r-- | db/seeds.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/db/seeds.rb b/db/seeds.rb index 00a0566..7fcd125 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -17,15 +17,20 @@ end load_data_file("data/items.yml").map do |gid, hash| item = Item.find_or_create_by(gid: gid) - item.name = hash[:name] - item.description = hash[:description] + item.assign_attributes(hash.except(:equip_slot, :usable)) item.equip_slot = hash[:equip_slot]&.to_sym item.usable = hash[:usable] || false - item.whatnot = hash[:whatnot] item.save end +load_data_file("data/locations.yml").map do |gid, hash| + location = Location.find_or_create_by(gid: gid) + location.update(hash) +end + load_data_file("data/activities.yml").map do |gid, hash| activity = Activity.find_or_create_by(gid: gid) - activity.update(hash) + activity.assign_attributes(hash.except(:location)) + activity.location = Location.find_by_gid(hash[:location]) + activity.save end |