Intermedio
18 novembre 2026Trova il bug: Ruby on Rails
Uno snippet di codice. Trova il bug, o dimostra che non ce n'è.
ruby
1class UsersController < ApplicationController
2 def show
3 @user = User.find(params[:id])
4 render json: @user
5 rescue ActiveRecord::RecordNotFound
6 render json: { error: 'User not found' }, status: :not_found
7 end
8endClicca sulle righe che causano il problema.
Il tuo verdetto
Un tentativo al giorno. La risposta appare subito dopo.
Mantieni la tua serie
Crea un account per conservare la tua serie e seguire i tuoi progressi.