Skip to content

Handle RecordNotFound in ImagesController#solution#8351

Merged
iHiD merged 1 commit intomainfrom
ihid/handle-record-not-found-in-images-controller
Feb 8, 2026
Merged

Handle RecordNotFound in ImagesController#solution#8351
iHiD merged 1 commit intomainfrom
ihid/handle-record-not-found-in-images-controller

Conversation

@iHiD
Copy link
Copy Markdown
Member

@iHiD iHiD commented Feb 8, 2026

Summary

  • Add rescue_from ActiveRecord::RecordNotFound, with: :render_404 to ImagesController
  • Solution.for! raises RecordNotFound when given invalid user/track/exercise slugs, which was causing unhandled 500 errors
  • Follows the same pattern used in DocsController, LegacyController, etc.

Test plan

  • Visit an image solution URL with an invalid user handle, track slug, or exercise slug — should render 404 instead of 500

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@iHiD iHiD merged commit 48f09bf into main Feb 8, 2026
41 checks passed
@iHiD iHiD deleted the ihid/handle-record-not-found-in-images-controller branch February 8, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant