Throw error when unsmile target reaction doesn't exist

This commit is contained in:
Andreas Nedbal 2023-11-05 13:10:21 +01:00 committed by Andreas Nedbal
parent 8ddfcef259
commit 93958cb9fd

View file

@ -13,7 +13,7 @@ module User::ReactionMethods
# unsmile an answer or comment
# @param item [ApplicationRecord] the answer/comment to unsmile
def unsmile(item)
Reaction.find_by(user: self, parent: item).destroy
Reaction.find_by!(user: self, parent: item).destroy
end
def smiled?(item)