Newer
Older
# == Schema Information
#
# Table name: communication_extranets
#
# id :uuid not null, primary key
# about_type :string indexed => [about_id]
# domain :string
# name :string
# registration_contact :string
# created_at :datetime not null
# updated_at :datetime not null
# about_id :uuid indexed => [about_type]
# university_id :uuid not null, indexed
# index_communication_extranets_on_university_id (university_id)
#
# Foreign Keys
#
# fk_rails_c2268c7ebd (university_id => universities.id)
#
class Communication::Extranet < ApplicationRecord
scope :ordered, -> { order(:name) }
scope :for_search_term, -> (term) {
where("
unaccent(communication_extranets.domain) ILIKE unaccent(:term) OR
unaccent(communication_extranets.name) ILIKE unaccent(:term)
", term: "%#{sanitize_sql_like(term)}%")
}
def self.with_host(host)
find_by domain: host
end
# For a single program, year is like cohort
return false if about.is_a? Education::Program
# if a school has a single program, same thing