You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In at least several controllers, .nil? checks are performed after calling .find( ... ). However, find throws an exception if an id is not found, so the checks are never reached.
They should be replaced with find_by where possible.
Some instances (found with grep -nr ".find(" -A 2)
course_user_data_controller.rb
@editCUD=@course.course_user_data.find(params[:id])if@editCUD.nil?flash[:error]="Can't find user in the course"redirect_to(action: "index") && returnend
groups_controller.rb
ass=@course.assessments.find(params[:ass])if !assflash[:error]="Assessment not found."redirect_to(action: :index) && return
users_controller.rb
user=User.find(params[:id])ifuser.nil?flash[:error]="Failed to edit user: user does not exist."redirect_to(users_path) && returnend
lti_nrps_controller.rb
lcd=LtiCourseDatum.find(params[:lcd_id])iflcd.nil? || lcd.membership_url.nil? || lcd.course_id.nil?raiseLtiLaunchController::LtiError.new("Unable to update roster",:bad_request)end
The text was updated successfully, but these errors were encountered:
In at least several controllers,
.nil?
checks are performed after calling.find( ... )
. However,find
throws an exception if anid
is not found, so the checks are never reached.They should be replaced with
find_by
where possible.Some instances (found with
grep -nr ".find(" -A 2
)course_user_data_controller.rb
groups_controller.rb
users_controller.rb
lti_nrps_controller.rb
The text was updated successfully, but these errors were encountered: