FIX: don't suggest name when email is empty

This commit is contained in:
Régis Hanol 2015-08-20 11:59:28 +02:00
parent d38c4d5f74
commit 49996bcdea
1 changed files with 2 additions and 3 deletions

View File

@ -171,9 +171,8 @@ class User < ActiveRecord::Base
end
def self.suggest_name(email)
return "" unless email
name = email.split(/[@\+]/)[0]
name = name.gsub(".", " ")
return "" if email.blank?
name = email.split(/[@\+]/)[0].gsub(".", " ")
name.titleize
end