Rails

Selectively Seed Data From Seed.yml From Rails Console

Posted by Weston Ganger on May 29, 2015

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:


Posted in Rails and Tagged with rails ruby yaml seed 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts