Skip to content

Commit 4180fea

Browse files
iHiDclaude
andauthored
Rescue RecordNotFound in BlogPostsController#show (#8348)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent db70c70 commit 4180fea

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

app/controllers/blog_posts_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ def index
1616
def show
1717
@post = BlogPost.published.find(params[:id])
1818
@other_posts = BlogPost.published.ordered_by_recency.includes(:author).where.not(id: @post.id).limit(6)
19+
rescue ActiveRecord::RecordNotFound
20+
render_404
1921
end
2022
end

0 commit comments

Comments
 (0)