Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# == Schema Information
#
# Table name: university_people
#
# id :uuid not null, primary key
# email :string
# first_name :string
# is_administrative :boolean
# is_author :boolean
# is_researcher :boolean
# is_teacher :boolean
# last_name :string
# phone :string
# slug :string
# created_at :datetime not null
# updated_at :datetime not null
# university_id :uuid not null
# user_id :uuid
#
# Indexes
#
# index_university_people_on_university_id (university_id)
# index_university_people_on_user_id (user_id)
#
# Foreign Keys
#
# fk_rails_... (university_id => universities.id)
# fk_rails_... (user_id => users.id)
#
class University::Person::Author < University::Person
def self.polymorphic_name
'University::Person::Author'
end
def git_path(website)
"content/authors/#{slug}/_index.html" if for_website?(website)
end
def for_website?(website)
is_author && communication_website_posts.published
.where(communication_website_id: website&.id)
.any?
end
end