Manuel Bustillo cc10fbfb83
Some checks failed
Run unit tests / rubocop (pull_request) Failing after 2m38s
Run unit tests / check-licenses (pull_request) Successful in 3m1s
Run unit tests / copyright_notice (pull_request) Successful in 1m55s
Run unit tests / unit_tests (pull_request) Successful in 5m25s
Run unit tests / build-static-assets (pull_request) Has been skipped
Store website content as HTML
2025-06-08 20:59:09 +02:00

28 lines
708 B
Ruby

# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
# frozen_string_literal: true
# == Schema Information
#
# Table name: weddings
#
# id :uuid not null, primary key
# slug :string not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_weddings_on_slug (slug) UNIQUE
#
class Wedding < ApplicationRecord
SLUG_REGEX = /[a-z\d-]+/
validates :slug, presence: true, uniqueness: true, format: { with: /\A#{SLUG_REGEX}\z/ }
has_many :guests, dependent: :delete_all
has_many :groups, dependent: :delete_all
has_many :invitations, dependent: :delete_all
has_one :website, dependent: :destroy
end