d48cda4081
CI / Test (ubuntu-latest, Node 18.x, bun) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, npm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, pnpm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, yarn) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 20.x, bun) (push) Failing after 17m13s
CI / Test (ubuntu-latest, Node 20.x, npm) (push) Failing after 18m42s
CI / Test (ubuntu-latest, Node 20.x, pnpm) (push) Failing after 15m0s
CI / Test (ubuntu-latest, Node 20.x, yarn) (push) Failing after 49m44s
CI / Test (ubuntu-latest, Node 22.x, bun) (push) Failing after 51m55s
CI / Test (ubuntu-latest, Node 22.x, pnpm) (push) Failing after 21m57s
CI / Test (ubuntu-latest, Node 22.x, npm) (push) Failing after 37m39s
CI / Test (ubuntu-latest, Node 22.x, yarn) (push) Failing after 34m7s
CI / Validate Components (push) Failing after 37m15s
CI / Python Tests (push) Failing after 10m1s
CI / Security Scan (push) Failing after 10m1s
CI / Lint (push) Failing after 17m12s
CI / Coverage (push) Failing after 20m19s
CI / Test (macos-latest, Node 18.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, yarn) (push) Has been cancelled
3.2 KiB
3.2 KiB
paths
| paths | |||||
|---|---|---|---|---|---|
|
Ruby パターン
このファイルは common/patterns.md を Ruby および Rails 固有のコンテンツで拡張します。
まず Rails Way
- 小規模および中規模の機能には、プレーンな Rails MVC と Active Record の規約から始める。
- モデル/コントローラの境界が複数の責務を担っている場合に、サービスオブジェクト、クエリオブジェクト、フォームオブジェクト、デコレータ、またはプレゼンターを導入する。
- 抽出したオブジェクトには
ManagerやProcessorのような汎用的なレイヤー名ではなく、実行するビジネス操作にちなんだ名前を付ける。
永続化
- マルチホスト本番 Rails アプリでは、既存プラットフォームが MySQL や SQLite を使用する明確な理由がない限り PostgreSQL を優先する。
- Rails 8 の SQLite ベースのデフォルトは、シングルホストまたは小規模なデプロイメントに適しているが、共有マルチサービスシステムに自動的に適合するわけではない。
- 生の SQL はクエリオブジェクトまたはモデルスコープの背後に配置し、すべての動的値をパラメータ化する。
バックグラウンドジョブとランタイムサービス
- グリーンフィールドの Rails 8 アプリで、適度なスループットとシンプルなデプロイメントが必要な場合は Solid Queue を使用する。
- 成熟したオブザーバビリティ、高スループット、既存の Redis インフラストラクチャ、または Pro/Enterprise 機能が必要な場合は Sidekiq を使用する。
- Solid Cache と Solid Cable はそのデプロイメントモデルがアプリに適合する場合に使用する。共有クロスサービス動作、高ファンアウト、または高度なデータ構造が重要な場合は Redis を使用する。
フロントエンド
- サーバーレンダリングの Rails アプリには Turbo、Stimulus、Importmap、Propshaft を使用した Hotwire を優先する。
- インタラクションの複雑さ、既存のプロダクトアーキテクチャ、またはチームのオーナーシップが追加のクライアントサーフェスを正当化する場合は、React、Vue、Inertia.js、または個別の SPA を使用する。
- ビューコンポーネント、パーシャル、プレゼンターはレンダリングの判断に集中させる。永続化と認可をテンプレートに含めない。
認証
- シンプルなセッション認証とパスワードリセットのニーズには Rails 8 認証ジェネレータを使用する。
- OAuth、MFA、confirmable/lockable フロー、マルチモデル認証、または大規模な既存 Devise フットプリントが要件に含まれる場合は Devise または他の確立された認証システムを使用する。
参考
サービス境界とアダプターパターンについてはスキル: backend-patterns を参照。