Manuel Bustillo 9d08ef6f18
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 38s
Add copyright notice / copyright_notice (pull_request) Successful in 1m7s
Run unit tests / unit_tests (pull_request) Successful in 1m34s
Update wedding slug rules to accept numbers and other chars
2024-12-01 18:17:37 +01:00

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