class Library::Publisher < ApplicationRecord
  belongs_to :school

  has_many :bib

  validates :name, uniqueness: { scope: :school_id, case_sensitive: true }, presence: true,
    length: { maximum: 255 }

  def self.search(term)
    return unless term

    where('name LIKE :term', term: "#{term}%")
  end
end
