Class: Spina::Admin::Journal::Affiliation
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Spina::Admin::Journal::Affiliation
- Defined in:
- app/models/spina/admin/journal/affiliation.rb
Overview
Rich join between an Institution and an Author. Associated with Articles via Authorships.
Since authors can in principle use different names in different articles, names are associated with affiilations, rather than with authors directly.
Validators
- Presence
Scopes
- sorted
-
sorted by surname in alphabetical order
Instance Attribute Summary collapse
-
#articles ⇒ ActiveRecord::Relation
Articles associated through Authorships.
-
#author ⇒ ActiveRecord::Relation
The Author whose affiliation this record holds.
-
#authorships ⇒ ActiveRecord::Relation
Directly associated Authorships.
-
#first_name ⇒ String
The first name(s) of the author.
-
#institution ⇒ ActiveRecord::Relation
The Institution to which the author is affiliated.
- #name ⇒ Object readonly
- #reversed_name ⇒ Object readonly
-
#status ⇒ Integer
The status of the author, which can be either primary (1) or other (0).
-
#surname ⇒ String
The last name(s) of the author.
Instance Attribute Details
#articles ⇒ ActiveRecord::Relation
Returns Spina::Admin::Journal::Articles associated through Spina::Admin::Journal::Authorships.
39 |
# File 'app/models/spina/admin/journal/affiliation.rb', line 39 has_many :articles, through: :authorships |
#author ⇒ ActiveRecord::Relation
Returns the Spina::Admin::Journal::Author whose affiliation this record holds.
30 |
# File 'app/models/spina/admin/journal/affiliation.rb', line 30 belongs_to :author |
#authorships ⇒ ActiveRecord::Relation
Returns directly associated Spina::Admin::Journal::Authorships.
36 |
# File 'app/models/spina/admin/journal/affiliation.rb', line 36 has_many :authorships, dependent: :destroy |
#first_name ⇒ String
Returns the first name(s) of the author.
30 |
# File 'app/models/spina/admin/journal/affiliation.rb', line 30 belongs_to :author |
#institution ⇒ ActiveRecord::Relation
Returns the Institution to which the author is affiliated.
33 |
# File 'app/models/spina/admin/journal/affiliation.rb', line 33 belongs_to :institution |
#name ⇒ Object (readonly)
50 51 52 |
# File 'app/models/spina/admin/journal/affiliation.rb', line 50 def name "#{first_name} #{surname}" end |
#reversed_name ⇒ Object (readonly)
56 57 58 |
# File 'app/models/spina/admin/journal/affiliation.rb', line 56 def reversed_name "#{surname}, #{first_name}" end |
#status ⇒ Integer
Returns the status of the author, which can be either primary (1) or other (0).
30 |
# File 'app/models/spina/admin/journal/affiliation.rb', line 30 belongs_to :author |
#surname ⇒ String
Returns the last name(s) of the author.
30 |
# File 'app/models/spina/admin/journal/affiliation.rb', line 30 belongs_to :author |