23 lines
555 B
Ruby
23 lines
555 B
Ruby
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: weddings
|
|
#
|
|
# id :uuid not null, primary key
|
|
# date :date not null
|
|
# 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 :date, presence: true
|
|
validates :slug, presence: true, uniqueness: true, format: { with: /\A#{SLUG_REGEX}\z/ }
|
|
end
|