diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/seeds.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/db/seeds.rb b/db/seeds.rb index 1e2888a..a513ee1 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -25,9 +25,11 @@ load_data_file("data/skills.yml").map do |gid, hash| skill.update(hash) end -load_data_file("data/items.yml").map do |gid, hash| - item = Item.find_or_create_by(gid: gid) - item.update(hash) +Dir["data/items/*"].each do |file_name| + load_data_file(file_name).map do |gid, hash| + item = Item.find_or_create_by(gid: gid) + item.update(hash) + end end load_data_file("data/locations.yml").map do |gid, hash| @@ -35,11 +37,13 @@ load_data_file("data/locations.yml").map do |gid, hash| location.update(hash) end -load_data_file("data/activities.yml").map do |gid, hash| - activity = Activity.find_or_create_by(gid: gid) - activity.assign_attributes(hash.except(:location)) - activity.location = Location.find_by_gid(hash[:location]) - activity.save +Dir["data/activities/*"].each do |file_name| + load_data_file(file_name).map do |gid, hash| + activity = Activity.find_or_create_by(gid: gid) + activity.assign_attributes(hash.except(:location)) + activity.location = Location.find_by_gid(hash[:location]) + activity.save + end end load_data_file("data/hearth_amenities.yml").map do |gid, hash| |