Add TicketType model with validations and fix dropdown menu

- Create TicketType model with Party association and Ticket relationship
- Add comprehensive validations for name, description, pricing, and date ranges
- Generate migration for ticket_types table with all required fields
- Add Alpine.js import to fix dropdown menu functionality
- Update ticket model with validations for qr_code, price, and status
This commit is contained in:
kbe
2025-08-23 19:31:17 +02:00
parent ef9cfd6cdf
commit b5b5ca1cc0
10 changed files with 129 additions and 8 deletions

8
app/models/ticket.rb Normal file
View File

@@ -0,0 +1,8 @@
class Ticket < ApplicationRecord
# Validations
validates :qr_code, presence: true, uniqueness: true
validates :party_id, presence: true
validates :user_id, presence: true
validates :price_cents, presence: true, numericality: { greater_than: 0 }
validates :status, presence: true, inclusion: { in: %w[active used expired refunded] }
end