Skip to content

Instantly share code, notes, and snippets.

@polyglotdev
Created October 10, 2018 01:57
Show Gist options
  • Save polyglotdev/8861d22f6ed702dcfc5064fbb1560cec to your computer and use it in GitHub Desktop.
Save polyglotdev/8861d22f6ed702dcfc5064fbb1560cec to your computer and use it in GitHub Desktop.
seeds.db
require 'random_data'
50.times do
Post.create!(
title: RandomData.random_sentence,
body: RandomData.random_paragraph
)
end
posts = Post.all
100.times do
Comment.create!(
post: posts.sample,
body: RandomData.random_paragraph
)
end
puts 'Seed finished'
puts '#{Post.count} posts created'
puts '#{Comment.count} comments created'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment