A notifications page next to workspace branding

Ruby · Rails · advanced · modification

Adds a notifications page to the workspace settings, next to the existing branding page. `config/routes.rb` adds a singular `resource :notifications` under the `settings` namespace. `Workspace` gains `digest_frequency` and `digest_day` as `store_accessor` keys on its `settings` JSON column, with inclusion validations. The admin check, the JSON rendering and the save-and-respond logic that `BrandingController` had inline move into a new `Settings::BaseController`; `BrandingController` and the new `NotificationsController` inherit from it and only declare their keys and strong params. `notifications_controller_test.rb` adds integration tests for reading and saving the digest settings, a save on each page leaving the other page's keys in place, validation, the missing-parameter 400 and the admin check.

Workspace app on Ruby 4.0 and Rails 8.1, SQLite in development, test and production (one database file; production runs Puma with several threads per process), Minitest integration tests. `settings` is a single `json` column on `workspaces` (`null: false`, default `{}`) and holds every page's keys; the app reads them only through the `store_accessor` methods. Existing and unchanged (not shown): `ApplicationController` includes the `Authentication` concern, whose `before_action :require_authentication` sets `Current.user` to the signed-in `User` or redirects to `new_session_path`; `Current` is an `ActiveSupport::CurrentAttributes` with `user`, and `Current.workspace` returns `Current.user.workspace`. A `User` belongs to one `Workspace` and has a string enum `role` (`member` / `admin`). The settings pages are part of the admin front end, which always nests the body under the page's key (`{"branding": {...}}`, `{"notifications": {...}}`) and sends JSON with string values and the CSRF token from `csrf_meta_tags`; forgery protection is on outside tests. The digest mailer (separate, unchanged) treats a `null` `digest_frequency` as `weekly` and a `null` `digest_day` as `monday`. The test helper `sign_in_as(user)` signs the integration session in.

Requirements

Files touched

Review this PR

Ruby practice