destroy votes with their corresponding user

This commit is contained in:
Kiara Grouwstra 2023-01-26 23:46:40 +01:00
parent 94fe0b204c
commit 7bc64b0740
1 changed files with 3 additions and 0 deletions

View File

@ -130,6 +130,9 @@ class UsersController < ApplicationController
# DELETE /users/1
# DELETE /users/1.json
def destroy
Vote.where(user_id: @user.id).each do |vote|
vote.destroy
end
@user.destroy
respond_to do |format|
format.html { redirect_to room_users_url(@user.room_id), notice: 'User was successfully destroyed.' }