Skip to content
Snippets Groups Projects
extranet.rb 762 B
Newer Older
Arnaud Levy's avatar
Arnaud Levy committed
# == 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
#  university_id :uuid             not null, indexed
#
# Indexes
#
#  index_communication_extranets_on_university_id  (university_id)
#
# Foreign Keys
#
#  fk_rails_c2268c7ebd  (university_id => universities.id)
#
class Communication::Extranet < ApplicationRecord
Arnaud Levy's avatar
Arnaud Levy committed
  include WithUniversity
Arnaud Levy's avatar
Arnaud Levy committed

  validates_presence_of :name, :domain

Arnaud Levy's avatar
Arnaud Levy committed
  has_one_attached_deletable :logo

  def self.with_host(host)
    find_by domain: host
  end

Arnaud Levy's avatar
Arnaud Levy committed
  def url
    "https://#{domain}"
  end

  def to_s
    "#{name}"
  end
end