commit: 8b9206f7d9565ad8b9026e5cc5e085e28ab0117a
parent: 306eb6e9c90295dcdff2a0094066542a46a8e634
Author: Eugen <eugen@zeonfederated.com>
Date: Thu, 19 Jan 2017 02:14:57 +0100
Try to avoid any potential loops
Diffstat:
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/app/models/account.rb b/app/models/account.rb
@@ -125,13 +125,9 @@ class Account < ApplicationRecord
def save_with_optional_avatar!
save!
- rescue ActiveRecord::RecordInvalid => invalid
- if invalid.record.errors[:avatar_file_size] || invalid.record.errors[:avatar_content_type]
- self.avatar = nil
- retry
- end
-
- raise invalid
+ rescue ActiveRecord::RecordInvalid
+ self.avatar = nil
+ save!
end
def avatar_remote_url=(url)