Selectively Seed Data From Seed.yml From Rails Console
Posted by Weston Ganger
I constantly find myself making a major change to a model and wanting to reseed only that models section from the seed.yml file in the rails console.
Open your rails console and run the following commands
seeds = YAML::load_file(Rails.root.join('db', 'seed.yml')) Category.create!(seeds['categories'])
This will seed only the ‘categories’ section of the seed.yml file
Related External Links: