Is there a way to hide the delete link through the action instead of using flash[:error]
?
the admin should delete anyone except himself so what i am asking for is when he view the user list he should not see delete link for himself , and he should see delete link for the other users so he can delete them.
def destroy
@user = User.find(params[:id])
if current_user?(@user)
flash[:error] = "Admin suicide warning: Can't delete yourself."
else
@user.destroy
flash[:success] = 'User deleted'
redirect_to users_path
end
end