score:1

it looks like user.valid? returns false, so your else statement kicks in:

render json: { error: 'failed to create user' }, status: :not_acceptable

the status: :not_acceptable generates the 406 error.

you should probably include the reason why user is not valid, and return a bad request response instead:

render json: { error: user.errors.full_messages}, status: :bad_request

Related Query

More Query from same tag