Make WebSection seeds idempotent
Each time we were loading the seeds file, more web sections were created. On production it meant running `db:seeds` several times created the records even if they already existed. During the test, it meant 5 more records were created before every test, so after ending a test run, thousands of records existed, making banner tests very slow.
This commit is contained in:
10
db/seeds.rb
10
db/seeds.rb
@@ -9,11 +9,11 @@ end
|
||||
|
||||
Setting.reset_defaults
|
||||
|
||||
WebSection.create(name: "homepage")
|
||||
WebSection.create(name: "debates")
|
||||
WebSection.create(name: "proposals")
|
||||
WebSection.create(name: "budgets")
|
||||
WebSection.create(name: "help_page")
|
||||
WebSection.where(name: "homepage").first_or_create
|
||||
WebSection.where(name: "debates").first_or_create
|
||||
WebSection.where(name: "proposals").first_or_create
|
||||
WebSection.where(name: "budgets").first_or_create
|
||||
WebSection.where(name: "help_page").first_or_create
|
||||
|
||||
# Default custom pages
|
||||
load Rails.root.join("db", "pages.rb")
|
||||
|
||||
Reference in New Issue
Block a user