|
| 1 | +--- |
| 2 | +name: rails-docs |
| 3 | +description: Use when asked about any Rails-specific topic — ActiveRecord, routing, controllers, views, mailers, jobs, Action Cable, Action Text, Active Storage, migrations, validations, callbacks, associations, caching, security, or Rails internals — including "how do I do X in Rails", debugging Rails behavior, or checking whether an API/option still exists or changed in Rails 8. Always consult the official guides and API docs rather than answering from memory alone, since trained knowledge can be stale or wrong about version-specific details, and this project pins Rails 8.0. |
| 4 | +--- |
| 5 | + |
| 6 | +# Rails official documentation lookup |
| 7 | + |
| 8 | +This project (HostedGPT) runs Rails 8.0, per the project's `CLAUDE.md`. Trained knowledge about |
| 9 | +Rails APIs can be outdated, mixed across versions, or simply wrong on specifics (option names, |
| 10 | +defaults, deprecations, callback ordering, etc.). Before answering a Rails-specific question or |
| 11 | +relying on a Rails API's exact behavior, check the official docs rather than guessing. |
| 12 | + |
| 13 | +## Sources |
| 14 | + |
| 15 | +- **Guides** (concepts, how-tos, conventions): https://guides.rubyonrails.org |
| 16 | + - Version-pinned guides are available at `https://guides.rubyonrails.org/v8.0/<guide-name>.html` |
| 17 | + if you need to confirm you're reading the Rails 8.0 version rather than edge/main. |
| 18 | +- **API reference** (exact method signatures, options, source): https://api.rubyonrails.org |
| 19 | + - Version-pinned API docs: `https://api.rubyonrails.org/v8.0/` |
| 20 | + |
| 21 | +## When to look things up |
| 22 | + |
| 23 | +Use `WebFetch` against the sources above when: |
| 24 | +- The question is about a specific Rails API's options, defaults, or behavior (e.g. "does |
| 25 | + `has_many` support `:strict_loading`?", "what does `config.active_record.encryption` need?"). |
| 26 | +- You're unsure whether something changed between Rails versions (deprecated, renamed, new in 8.0). |
| 27 | +- You're about to write code that depends on exact method signatures, callback ordering, or |
| 28 | + routing/DSL syntax you're not fully certain of. |
| 29 | +- The user asks a "how do I do X in Rails" question that isn't already answered by this project's |
| 30 | + own conventions in `CLAUDE.md`. |
| 31 | + |
| 32 | +Skip the lookup for things you can verify faster by reading this codebase directly (e.g. "how does |
| 33 | +this app handle streaming?" — that's answered by `app/services/ai_backend/`, not the guides), or for |
| 34 | +very basic Ruby/Rails knowledge you're confident hasn't changed across versions. |
| 35 | + |
| 36 | +## How to look things up |
| 37 | + |
| 38 | +1. Identify the right guide or API page (e.g. Active Record Associations, Action Mailer Basics). |
| 39 | +2. Fetch it with `WebFetch`, preferring the `/v8.0/` pinned URL when version accuracy matters. |
| 40 | +3. If the guide doesn't have the exact method signature, cross-check `api.rubyonrails.org` for the |
| 41 | + precise method/class documentation. |
| 42 | +4. Prefer the official source over Stack Overflow, blog posts, or other secondary sources when they |
| 43 | + conflict. |
| 44 | + |
| 45 | +## Applying this project's conventions |
| 46 | + |
| 47 | +Official Rails docs describe what's *possible*; they don't override this project's own patterns. |
| 48 | +After confirming Rails behavior, still follow `CLAUDE.md`'s conventions — e.g. provider logic goes |
| 49 | +in `app/services/ai_backend/`, soft deletion via `deleted_at` + `not_deleted` scopes, feature flags |
| 50 | +via `Feature.<name>?`/`Setting.<name>`, and don't hard-code model lists (`models.yml` instead). |
0 commit comments