Last active
June 1, 2019 15:29
-
-
Save dmshvetsov/6317604 to your computer and use it in GitHub Desktop.
How to seed your database with JSON/YAML. Source http://snippets.aktagon.com
This file contains hidden or 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
json = ActiveSupport::JSON.decode(File.read('db/seeds/countries.json')) | |
json.each do |a| | |
Country.create!(a['country'], without_protection: true) | |
end |
It helped a lot, thanks!
Thanks for this. Helped a lot.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
q2w3e45iuikujjygtfdfgfdrewsde3wwwrewq