← Alle Vorlagen

Konvention vor Konfiguration, Service Objects für Abläufe, System Tests für Flows.

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.

  1. Convention over configuration. Names, folders, routes (resources) and RESTful controller actions follow Rails conventions. Departing from a convention needs a reason in the plan.

  2. Service objects for workflows. A workflow that touches several models or external services is a plain Ruby object in app/services with one public call method returning a result. Controllers and callbacks do not orchestrate multi-step work.

  3. 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.

  4. Thin controllers, strong params. Controllers permit input with strong parameters (params.expect or require/permit), call a model or service and render. Business rules in a controller fail the review.

  5. 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.

  6. Reversible, safe migrations. Migrations are reversible and the schema.rb change is in the same pull request. Indexes on large tables are added concurrently and strong_migrations runs in CI.

  7. 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.

  8. No N+1 queries. Associations rendered in lists are loaded with includes or preload; Bullet or strict_loading is enabled in development and tests.