diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index f8e8a2efa..dfecb2339 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -52,6 +52,8 @@ class User < ApplicationRecord scope :admins, -> { where(admin: true) } scope :confirmed, -> { where.not(confirmed_at: nil) } + before_validation :sanitize_languages + def confirmed? confirmed_at.present? end @@ -77,4 +79,10 @@ class User < ApplicationRecord def setting_auto_play_gif settings.auto_play_gif end + + private + + def sanitize_languages + allowed_languages.reject!(&:blank?) + end end |