The Problem
An HR system for an IT startup and for a septic service company are different worlds. The startup needs a "GitHub username" field, a clinic needs "License number", a transport company needs "ADR permit category."
The classic approach — a migration for every field — doesn't scale.
Solution: Dictionary with field_schema
A Dictionary model with kind: :field_schema stores a JSON schema describing custom fields per entity type per company. One custom_data JSONB column on the target model holds the values.
How it works
- HR defines fields in the admin UI (or AI generates them via
company_bootstrap) - Forms auto-render based on the schema (text, select, date, number, boolean, textarea)
- Validation runs against the schema — required fields, regex patterns
- AI agents parse documents against the same schema
Key benefit
Zero migrations. HR configures fields in UI. Validation, AI parsing, and audit all follow the schema automatically. The pattern is reused in Triage for custom fields per ticket type.
Comments (0)