We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 14604af commit 73d32b7Copy full SHA for 73d32b7
app/controllers/users_controller.rb
@@ -12,8 +12,14 @@ class UsersController < ApplicationController
12
13
# GET /users/1
14
def show
15
- @user = User.find(params[:id].to_i)
16
- render json: @user
+ begin
+ @user = User.find(params[:id].to_i)
17
+ render json: @user
18
+ rescue ActiveRecord::RecordNotFound => e
19
+ render json: {
20
+ error: e.to_s
21
+ }, status: :not_found
22
+ end
23
end
24
25
# POST /users V1
0 commit comments