v9.0.0
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 withRails.configuration.x.project_settings.*. - Platform settings: edited by admins on the Platform Settings page and stored in
cm_platform_settings. Read them withCmAdmin::PlatformSettings, which is backed byRails.cacheand expired whenever a setting is created, updated or deleted, so changes apply straight away in every process, with no restart.
What changed
| Before | Now |
|---|---|
PLATFORM_SETTINGS["slug"]: a frozen hash loaded at boot; changes needed a restart of the app and Sidekiq | CmAdmin::PlatformSettings["slug"], cached and expired on save |
| File settings returned a lambda that had to be called to get the URL | File 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 them | config.x.project_settings is only ever set from config/application.rb |
Those five settings were seeded by CmPlatformSetting.add_cm_default_settings | They 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
2. Replace PLATFORM_SETTINGS (recommended)
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"].callmust drop the.call. - A slug with no matching setting raises
CmAdmin::PlatformSettings::NotFoundinstead of returningnil. Where the code has a fallback, usefetchwith a default. - Only
[]andfetchare supported. Other Hash methods such asdig,each,keysandto_hraiseNoMethodError.
# 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_configCmPlatformSetting::PROJECT_SETTINGS_SLUG_MAP
Checklist
- Copy any admin-edited project values into
config/application.rb, then delete those five platform setting rows. - Replace
PLATFORM_SETTINGS[...]withCmAdmin::PlatformSettings[...](or.fetch(slug, default)where a missing setting is expected), and drop any.callon file settings. - Remove any calls to
CmPlatformSetting.sync_project_settings_to_config.