From 7997e112fbc67eef309bb3969ad41f90a8bfbc89 Mon Sep 17 00:00:00 2001 From: David Gay Date: Sun, 2 May 2021 16:15:55 -0400 Subject: Add skills --- db/seeds.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'db/seeds.rb') diff --git a/db/seeds.rb b/db/seeds.rb index f3a0480..637a355 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,12 @@ # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create(name: 'Luke', movie: movies.first) + +def load_data_file(path) + YAML.load(File.read(path)).deep_transform_keys(&:to_sym) +end + +load_data_file("data/skills.yml").map do |gid, hash| + skill = Skill.find_or_create_by(gid: gid) + skill.update(hash) +end -- cgit v1.2.3