Extract method to reset default settings
This commit is contained in:
@@ -121,5 +121,9 @@ class Setting < ApplicationRecord
|
||||
"youtube_handle": nil
|
||||
}
|
||||
end
|
||||
|
||||
def reset_defaults
|
||||
defaults.each { |name, value| self[name] = value }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user