Convenzione sulla configurazione, service object per i processi, system test per i flussi.
Constitution — Ruby on Rails app
Version 1.0.0 · Ratified 2026-11-10
These principles hold for every spec, plan and task of the project. A spec may add rules; it never weakens these.
-
Convention over configuration. Names, folders, routes (
resources) and RESTful controller actions follow Rails conventions. Departing from a convention needs a reason in the plan. -
Service objects for workflows. A workflow that touches several models or external services is a plain Ruby object in
app/serviceswith one publiccallmethod returning a result. Controllers and callbacks do not orchestrate multi-step work. -
System tests for flows. Every user flow in a spec has a system test (Capybara with a headless browser) that runs it end to end. A flow without one is not done.
-
Thin controllers, strong params. Controllers permit input with strong parameters (
params.expectorrequire/permit), call a model or service and render. Business rules in a controller fail the review. -
Careful callbacks. Model callbacks only keep a record’s own data consistent. Sending email, calling APIs or touching other models from a callback fails the review; that work belongs in a service or a job.
-
Reversible, safe migrations. Migrations are reversible and the
schema.rbchange is in the same pull request. Indexes on large tables are added concurrently and strong_migrations runs in CI. -
Jobs for anything slow. Email, exports and third-party calls run in Active Job (Solid Queue or Sidekiq) with retries, and jobs are idempotent. A request that waits on a third-party API fails the review.
-
No N+1 queries. Associations rendered in lists are loaded with
includesorpreload; Bullet orstrict_loadingis enabled in development and tests.