openSNP/snpr

View on GitHub
app/models/mendeley_paper.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

class MendeleyPaper < ApplicationRecord
  include PgSearchCommon

  has_many :snp_references, as: :paper
  has_many :snps, through: :snp_references
  validates_presence_of :title, :uuid
  validates_uniqueness_of :uuid

  pg_search_common_scope against: :title

  def first_author
    read_attribute(:first_author).presence || "Unknown"
  end
end