From e239fc30503ceaf9ae6ba51233ac3394dcd766f5 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 16 Mar 2016 21:23:40 +0100 Subject: [PATCH] Fix error when unfollowing somebody who wasn't followed in the first place --- app/models/account.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/account.rb b/app/models/account.rb index c92bb1574..524d05f86 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -36,7 +36,8 @@ class Account < ActiveRecord::Base end def unfollow!(other_account) - self.active_relationships.find_by(target_account: other_account).destroy + follow = self.active_relationships.find_by(target_account: other_account) + follow.destroy unless follow.nil? end def following?(other_account)