Load seed data from Rails app
To load seed data from Rails app,
Rails.application.load_seed
I had the usecase, where some of the constants defined were using some fixed data from database.
rake db:seed
was also failing because it was trying to define those constants first.
So i had to seed data from the Rails app itself. So i put above code in one of my initializers based on a condition.
Written by Prathamesh Sonpatki
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#