diff --git a/app/models/setting.rb b/app/models/setting.rb index a820937be..df9a34614 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -121,5 +121,9 @@ class Setting < ApplicationRecord "youtube_handle": nil } end + + def reset_defaults + defaults.each { |name, value| self[name] = value } + end end end diff --git a/db/seeds.rb b/db/seeds.rb index 5acdcb9b3..37599fd0c 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -7,9 +7,7 @@ if Administrator.count == 0 && !Rails.env.test? admin.create_administrator end -Setting.defaults.each do |name, value| - Setting[name] = value -end +Setting.reset_defaults WebSection.create(name: "homepage") WebSection.create(name: "debates")