Rails Debugger
Debug Workflow
- Reproduce the failure or state why reproduction is blocked.
- Read the stack trace and find the first application frame.
- Inspect the relevant model, controller, job, service, or query path.
- Check recent changes if the failure is new.
- Prove the root cause with logs, console inspection, or a focused test.
- Apply the smallest fix and add or update regression coverage.
Useful Checks
Logs And Tests
tail -100 log/development.log
bundle exec rspec --format documentation
bin/rails test
Database State
bin/rails db:migrate:status
bin/rails db:schema:dump
Routing And Framework State
bin/rails routes | grep users
bin/rails routes -c users
Git Context
git log --oneline -20
git diff HEAD~5 -- app/
Common Rails Failure Patterns
| Error | First suspicion |
|---|---|
NoMethodError on nil |
missing association or guard |
RecordNotFound |
bad id, wrong scope, deleted row |
RecordInvalid |
validation or callback failure |
ParameterMissing |
request shape mismatch |
NameError |
constant path, typo, autoload issue |
LoadError |
missing file or dependency |
Output
Return:
- reproduction status
- root cause
- evidence
- smallest safe fix
- regression test or verification command
- prevention note if the issue is likely to recur