Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding data seeds

  • Loading branch information...
commit 03175ee82703fda10285760d5de66e6725c1d55e 1 parent 705183c
@jcasimir jcasimir authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 db/seeds.rb
View
12 db/seeds.rb
@@ -5,3 +5,15 @@
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
+
+tags = (0..10).collect{ Fabricate(:tag) }
+
+10.times do
+ article = Fabricate(:article)
+ article.created_at = article.created_at - (rand(300) + 100).hours
+ article.tags = tags.sort_by{ rand }[0..rand(tags.length)]
+ article.save
+ (rand(10)).times do
+ Fabricate(:comment, :article => article, :created_at => article.created_at + rand(100).hours)
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.