Comma in Update method

This week, I made couple CRUD apps. My app’s parameters were only ‘name’ and ‘last_name’. When I was running the update method in my terminal, the first parameter, ‘name’ was taking in an array of the name and the last name.

My code was as follows: = params[:name],
user.last_name = params[:last_name]

I then decided to delete the comma next to params[:name] and my problem went away.

I learned that if there is a comma next to the new value I want to change, the output will be the array of all of the params I put in. The correct code is below:

def update
the_id = params[:id]
user = User.find_by(id: the_id) = params[:name]
user.last_name = params[:last_name]
render json: user.as_json