Newer
Older
# == Schema Information
#
# Table name: communication_extranets
#
# id :uuid not null, primary key
# domain :string
# name :string
# created_at :datetime not null
# updated_at :datetime not null
# 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