only user that created rating can delete it

This commit is contained in:
Aaro Koivukangas
2023-08-11 17:50:36 +03:00
parent 8802652778
commit e9987eef51
+2 -2
View File
@@ -22,7 +22,7 @@ class RatingsController < ApplicationController
def destroy
rating = Rating.find params[:id]
rating.delete
redirect_to ratings_path
rating.delete if current_user == rating.user
redirect_to user_path current_user
end
end