diff options
author | David Gay <david@davidgay.org> | 2021-05-02 16:15:55 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-02 16:15:55 -0400 |
commit | 7997e112fbc67eef309bb3969ad41f90a8bfbc89 (patch) | |
tree | 6da48af487ae581365fcc0d6d8fa6894e3724506 /db/seeds.rb | |
parent | 2b3422be0a68b18125bb471bef7adcc32cd3b486 (diff) |
Add skills
Diffstat (limited to 'db/seeds.rb')
-rw-r--r-- | db/seeds.rb | 9 |
1 files changed, 9 insertions, 0 deletions
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 |