1
0
Fork 0

Improve method Profile#full_name

This commit is contained in:
Alex Kotov 2021-03-10 14:59:09 +05:00
parent fca3cfa071
commit 9bd7a6fa13
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@ class Profile < ApplicationRecord
has_many :posts
def full_name
[first_name, last_name].map(&:presence).compact.join ' '
[first_name, last_name].map(&:presence).compact.join(' ').presence ||
"Profile#{" ##{id}" if id.present?}"
end
end