Skip to content

Commit c9ea3f3

Browse files
committed
Made seeds.rb generate comments.
1 parent bca1173 commit c9ea3f3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

db/seeds.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# Clear existing records
1111
User.destroy_all
1212
Article.destroy_all
13+
Comment.destroy_all
1314

1415
# Create users
1516
users = [
@@ -37,3 +38,14 @@
3738
user: users.sample
3839
)
3940
end
41+
42+
articles = Article.all
43+
44+
# Create comments
45+
90.times do |i|
46+
Comment.create!(
47+
text: "Sample Comment #{i + 1}",
48+
article: articles.sample,
49+
user: users.sample
50+
)
51+
end

0 commit comments

Comments
 (0)