From vanilla-rails
Use when designing content systems where 5+ distinct types need to comingle in feeds, timelines, or searches with shared metadata and operations - NOT for simple polymorphic associations or 1-3 similar types
How this skill is triggered — by the user, by Claude, or both
Slash command
/vanilla-rails:delegated-typesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
A container model (Recording) unifies many content types (Recordables) that share metadata, access control, and operations.
A container model (Recording) unifies many content types (Recordables) that share metadata, access control, and operations.
Core insight: When many content types must comingle and share behavior, create a unified container rather than duplicating metadata or using complex polymorphic queries.
digraph decision {
"How many content types?" [shape=diamond];
"Do they comingle in UI?" [shape=diamond];
"Share metadata/operations?" [shape=diamond];
"Direct associations" [shape=box];
"Delegated types" [shape=box];
"Consider merging types" [shape=box];
"How many content types?" -> "Direct associations" [label="1-2"];
"How many content types?" -> "Do they comingle in UI?" [label="3-4"];
"How many content types?" -> "Share metadata/operations?" [label="5+"];
"Do they comingle in UI?" -> "Consider merging types" [label="rarely"];
"Do they comingle in UI?" -> "Share metadata/operations?" [label="often"];
"Share metadata/operations?" -> "Direct associations" [label="no"];
"Share metadata/operations?" -> "Delegated types" [label="yes"];
}
Use when:
Don't use when:
| Decision | Answer |
|---|---|
| 1-2 content types | Direct associations |
| 3-4 types, rarely comingle | Consider merging or direct |
| 3-4 types, often comingle | Maybe delegated types |
| 5+ types, shared metadata | Delegated types |
| Only 1 type left | Flatten (see flattening.md) |
| Container adds no value | Flatten |
| Aspect | Simple Polymorphic | Delegated Types |
|---|---|---|
| Query target | Each concrete type | Recording (container) |
| Shared metadata | Duplicated in each table | Once in Recording |
| Pagination | Complex (merge in Ruby) | Natural (query Recording) |
| Access control | Per-type | On Recording |
Basecamp uses this for: Messages, Documents, Uploads, Comments, Todos - unified project timeline with shared access control and operations.
Fizzy removed it: When only Comments remained after merging EventSummary (see flattening.md).
npx claudepluginhub zemptime/zemptime-marketplace --plugin vanilla-railsModels inheritance hierarchies and type-varying relationships in relational databases using STI, CTI, or shared foreign key patterns. Covers tradeoffs and anti-patterns.
Designs Rails models using ActiveRecord patterns: validations, callbacks, scopes, associations, concerns, query objects, form objects. Enforces fat models, thin controllers, and N+1 prevention.
Provides Rails Active Record patterns for models, associations, queries, validations, callbacks, and scopes. Useful for robust model implementation and optimization.