23 lines
555 B
Ruby
Raw Permalink Normal View History

2024-11-30 18:31:48 +00:00
# Copyright (C) 2024 Manuel Bustillo
2024-11-30 19:24:59 +01:00
# == 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-]+/
2024-11-30 19:24:59 +01:00
validates :date, presence: true
validates :slug, presence: true, uniqueness: true, format: { with: /\A#{SLUG_REGEX}\z/ }
2024-11-30 19:24:59 +01:00
end