Created
July 20, 2018 16:58
-
-
Save pjbelo/a6fb7155725c9bb64cd0b86323351e47 to your computer and use it in GitHub Desktop.
split and organize seeds.rb [rails]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# store all seeds inside the folder db/seeds | |
# files are sorted alphabetically before loading them, so we can make sure the files are processed in order | |
# choose the filenames wisely, e.g. something like 0100_operators.rb, 0200_companies.rb, 0300_products.rb ...) | |
# | |
Dir[File.join(Rails.root, 'db', 'seeds', '*.rb')].sort.each { |seed| load seed } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment