bans: fix exception when username is blank.

Fix exception when submitting the ban form and the username is blank.
This commit is contained in:
evazion
2021-03-07 21:19:32 -06:00
parent 5b37ac3adb
commit 28d101eaa7
2 changed files with 6 additions and 1 deletions

View File

@@ -43,7 +43,7 @@ class Ban < ApplicationRecord
end
def validate_user_is_bannable
errors.add(:user, "is already banned") if user.is_banned?
errors.add(:user, "is already banned") if user&.is_banned?
end
def update_user_on_create