Newer
Older
# == Schema Information
#
# Table name: research_journal_volumes
#
# id :uuid not null, primary key
# slug :string
# title :string
# created_at :datetime not null
# updated_at :datetime not null
# research_journal_id :uuid not null
# university_id :uuid not null
#
# Indexes
#
# index_research_journal_volumes_on_research_journal_id (research_journal_id)
# index_research_journal_volumes_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_... (research_journal_id => research_journals.id)
# fk_rails_... (university_id => universities.id)
#
class Research::Journal::Volume < ApplicationRecord
belongs_to :university
belongs_to :journal, foreign_key: :research_journal_id
scope :ordered, -> { order(number: :desc, published_at: :desc) }
def cover_path
"/assets/img/volumes/#{id}#{cover.filename.extension_with_delimiter}"
end
"content/volumes/#{published_at.year}/#{published_at.strftime "%Y-%m-%d"}-#{slug}.html" if published_at
end
def git_dependencies_static
articles + researchers
end