Newer
Older
#
# 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
#
# Indexes
#
#
# Foreign Keys
#
# fk_rails_... (university_id => universities.id)
#
has_many :pages, foreign_key: :communication_website_id
def self.with_host(host)
find_by domain: extract_domain_from(host)
end
# Website domain
# Production with domain www.iut.u-bordeaux-montaigne.fr
# Production without www.iut.u-bordeaux-montaigne.fr.websites.osuny.org
# Staging www.iut.u-bordeaux-montaigne.fr.websites.osuny.dev
# Dev www.iut.u-bordeaux-montaigne.fr.websites.osuny
def self.extract_domain_from(host)
host.remove('.websites.osuny.org')
.remove('.websites.osuny.dev')
.remove('.websites.osuny')
end