summaryrefslogtreecommitdiff
path: root/db/seeds.rb
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-02 16:15:55 -0400
committerDavid Gay <david@davidgay.org>2021-05-02 16:15:55 -0400
commit7997e112fbc67eef309bb3969ad41f90a8bfbc89 (patch)
tree6da48af487ae581365fcc0d6d8fa6894e3724506 /db/seeds.rb
parent2b3422be0a68b18125bb471bef7adcc32cd3b486 (diff)
Add skills
Diffstat (limited to 'db/seeds.rb')
-rw-r--r--db/seeds.rb9
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