rails
v1.0.1Build reliable Rails apps avoiding ActiveRecord traps, N+1 queries, and callback pitfalls.
Installation
Please help me install the skill `rails` from SkillHub official store.
npx skills add ivangdavila/rails
Quick Reference
| Topic | File |
|---|---|
| N+1, callbacks, validations, scopes | activerecord.md |
| Strong params, filters, render | controllers.md |
| Route conflicts, constraints | routing.md |
| Partials, helpers, caching, XSS | views.md |
| ActiveJob, Sidekiq, retries | jobs.md |
| Mass assignment, CSRF, SQL injection | security.md |
Critical Rules
savereturns false on failure —save!raises, check return or use bangupdate_all/delete_allskip callbacks and validations — data corruption if unawarefind_eachfor batches —Model.all.eachloads entire table into memoryredirect_todoesn't halt execution — code after it runs, useand returndependent: :destroymissing — orphan records accumulate foreverdefault_scopepollutes all queries including joins — almost always wrong- Callbacks chain silently —
throw :abortstops save but returns false, not exception includeswithoutreferencesinwherestring — N+1 still happens||=memoization caches nil/false — usedefined?(@var) ? @var : @var = computehas_many through:vshas_and_belongs_to_many— latter has no join model for attrs- Nested
before_action— multiple inheritance makes flow unreadable renderdoesn't stop action — code continues, duplicate render crashes