Add a new setting to choose the server landing page (#36588)
This commit is contained in:
19
db/migrate/20251023210145_migrate_landing_page_setting.rb
Normal file
19
db/migrate/20251023210145_migrate_landing_page_setting.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MigrateLandingPageSetting < ActiveRecord::Migration[8.0]
|
||||
class Setting < ApplicationRecord; end
|
||||
|
||||
def up
|
||||
setting = Setting.find_by(var: 'trends_as_landing_page')
|
||||
return unless setting.present? && setting.attributes['value'].present?
|
||||
|
||||
value = YAML.safe_load(setting.attributes['value'], permitted_classes: [ActiveSupport::HashWithIndifferentAccess, Symbol])
|
||||
|
||||
Setting.upsert(
|
||||
var: 'landing_page',
|
||||
value: value ? "--- trends\n" : "--- about\n"
|
||||
)
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_10_07_142305) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_10_23_210145) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_catalog.plpgsql"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user