Skip to main content

v9.0.0

warning

This release contains breaking changes. Work through the Checklist before upgrading.

Settings are now split into two clearly separate kinds that never override each other:

  • Project settings: set by developers in config/application.rb (config.x.project_settings): project name, slug, logo URL, favicon URL and default email. Read them with Rails.configuration.x.project_settings.*.
  • Platform settings: edited by admins on the Platform Settings page and stored in cm_platform_settings. Read them with CmAdmin::PlatformSettings, which is backed by Rails.cache and expired whenever a setting is created, updated or deleted, so changes apply straight away in every process, with no restart.

What changed​

BeforeNow
PLATFORM_SETTINGS["slug"]: a frozen hash loaded at boot; changes needed a restart of the app and SidekiqCmAdmin::PlatformSettings["slug"], cached and expired on save
File settings returned a lambda that had to be called to get the URLFile settings return an Active Storage redirect path string
Project Name, Project Slug, Logo URL, Favicon URL and Default Email platform settings overwrote config.x.project_settings, but only in the process that saved themconfig.x.project_settings is only ever set from config/application.rb
Those five settings were seeded by CmPlatformSetting.add_cm_default_settingsThey are no longer seeded

See Platform Settings for the full API.

Required changes​

1. Move project values into config/application.rb​

If admins changed Project Name, Project Slug, Logo URL, Favicon URL or Default Email on the Platform Settings page, those values no longer apply. Copy them into config/application.rb:

config.x.project_settings.name = "Acme"
config.x.project_settings.slug = "acme"
config.x.project_settings.logo_url = "https://cdn.example.com/logo.png"
config.x.project_settings.favicon_url = "https://cdn.example.com/favicon.png"
config.x.project_settings.default_from_email = "no-reply@example.com"

Then delete the old rows so they don't confuse admins:

CmPlatformSetting.where(slug: %w[project-name project-slug logo-url favicon-url default-email]).destroy_all

PLATFORM_SETTINGS still works: PLATFORM_SETTINGS["slug"] is forwarded to CmAdmin::PlatformSettings["slug"], so it finds the setting by slug and reads the same cached value. It is deprecated, though, and reports a cm-admin deprecation warning through Rails.application.deprecators each time it is used. In development every cm-admin deprecation raises ActiveSupport::DeprecationException, so remaining uses are caught before they ship; in staging and production it keeps working. Compared with the old frozen hash there are three differences:

  • File settings return a path string instead of a lambda, so code like PLATFORM_SETTINGS["login-image"].call must drop the .call.
  • A slug with no matching setting raises CmAdmin::PlatformSettings::NotFound instead of returning nil. Where the code has a fallback, use fetch with a default.
  • Only [] and fetch are supported. Other Hash methods such as dig, each, keys and to_h raise NoMethodError.
# Before
PLATFORM_SETTINGS["ct-bot-model"].presence || "openai/gpt-5.6-sol"

# After
CmAdmin::PlatformSettings.fetch("ct-bot-model", "openai/gpt-5.6-sol")

Removed​

  • CmPlatformSetting.sync_project_settings_to_config
  • CmPlatformSetting::PROJECT_SETTINGS_SLUG_MAP

Checklist​

  1. Copy any admin-edited project values into config/application.rb, then delete those five platform setting rows.
  2. Replace PLATFORM_SETTINGS[...] with CmAdmin::PlatformSettings[...] (or .fetch(slug, default) where a missing setting is expected), and drop any .call on file settings.
  3. Remove any calls to CmPlatformSetting.sync_project_settings_to_config.