Code RoomUser update permits all fields
HardPrep Room Coding #2061

User update permits all fields

Code reviewCode quality & reviewSenior–Staff~22 min

Review this Ruby on Rails users controller.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 22 min
Mark a line and say what kind of problem it is.0 findings
1class UsersController < ApplicationController
2 def update
3 @user = User.find(params[:id])
4 if @user.update(user_params)
5 render json: @user
6 else
7 render json: @user.errors, status: :unprocessable_entity
8 end
9 end
10 
11 private
12 
13 def user_params
14 params.require(:user).permit!
15 end
16end
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.