Use a counter and append the index to make sure slugs are unique (#13981)
There's a unique index page on slugs that failed today during a PR merge, where 'et' was the `Faker::Lorem.word` selected both times. Add a suffix to the generated word to ensure these are unique and an index collision doesn't happen.
This commit is contained in:
parent
e38196df6f
commit
8158ea3cd2
1 changed files with 2 additions and 2 deletions
|
|
@ -234,9 +234,9 @@ end
|
|||
##############################################################################
|
||||
|
||||
seeder.create_if_none(Page) do
|
||||
2.times do
|
||||
2.times do |t|
|
||||
Page.create!(
|
||||
slug: Faker::Lorem.word,
|
||||
slug: "#{Faker::Lorem.word}-#{t}",
|
||||
body_html: "<p>#{Faker::Hipster.paragraph(sentence_count: 2)}</p>",
|
||||
title: "#{Faker::Lorem.word} #{rand(100)}",
|
||||
description: "A test page",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue