This repository has been archived on 2023-05-11. You can view files and clone it, but cannot push or open issues or pull requests.
2021-03-10 09:27:11 +00:00
|
|
|
class Profile < ApplicationRecord
|
2021-03-10 09:31:29 +00:00
|
|
|
has_many :posts
|
2021-03-10 09:40:17 +00:00
|
|
|
|
2021-03-10 10:41:07 +00:00
|
|
|
has_many :outgoing_followships,
|
|
|
|
class_name: 'Followship',
|
|
|
|
foreign_key: :subject_profile_id
|
|
|
|
|
|
|
|
has_many :incoming_followships,
|
|
|
|
class_name: 'Followship',
|
|
|
|
foreign_key: :object_profile_id
|
|
|
|
|
2021-03-10 09:40:17 +00:00
|
|
|
def full_name
|
2021-03-10 09:59:09 +00:00
|
|
|
[first_name, last_name].map(&:presence).compact.join(' ').presence ||
|
|
|
|
"Profile#{" ##{id}" if id.present?}"
|
2021-03-10 09:40:17 +00:00
|
|
|
end
|
2021-03-10 09:27:11 +00:00
|
|
|
end
|