Repository navigation
fix: The set_project method on line 862-864 queries for a pr... - #151
Merged
Merged
Conversation
fix: app/controllers/performance_controller.rb
alexshapalov
marked this pull request as ready for review
April 20, 2026 21:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐛 Bug Fix: ActiveRecord::RecordNotFound
Issue ID: #2514
Controller:
PerformanceController#indexOccurrences: 2 times
First seen: 2026-04-20 17:09
Last seen: 2026-04-20 17:09
🔍 Root Cause Analysis
The
set_projectmethod on line 862-864 queries for a project byidwithout scoping to the current account. However, the error message shows the query IS scoped toaccount_id, which means the issue is that project ID 30 doesn't exist in the current user's account. The user is attempting to access a project they don't have permission to view, or the project was deleted.🔧 Suggested Fix
File:
app/controllers/performance_controller.rbLine: 862
Before:
After:
📋 Error Details
Error Message:
Stack Trace (top frames):
Request Context:
GET/projects/30/performance?sort=status_desc🛡️ Prevention
find_byinstead offindto avoid raisingRecordNotFoundexceptions; this allows graceful error handling.performance_path) when a requested resource doesn't exist in the user's scope, rather than letting the exception propagate.rescue_from ActiveRecord::RecordNotFoundhandler at the controller level if you want centralized error handling across all actions.✅ Checklist
Generated by ActiveRabbit AI