Class: OpenLoam::Config
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- OpenLoam::Config
- Includes:
- GeneratedKey
- Defined in:
- app/models/open_loam/config.rb
Overview
A single configuration setting: one namespaced key, one JSON-able value.
Deliberately NOT a OpenLoam::TenantRecord. A setting exists at two levels — a GLOBAL default (tenant_id NULL) that every tenant sees, and a per-tenant OVERRIDE (tenant_id set) that wins for that one tenant — so tenancy is a nullable column here, not a default_scope. Resolving a key means reading across both levels at once, which is why the lookup lives in vetted gem code (OpenLoam::Configs), never in app code (see the tenancy allowlist in test/open_loam_guardrails_test.rb).
The value goes in a json column, so a bool, number, string, array, or hash all round-trip under the same key. Row existence — not the value — is what marks a key as set, so the value may legitimately be JSON null.