diff options
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 |