Some checks failed
		
		
	
	Run unit tests / rubocop (pull_request) Successful in 48s
				
			Run unit tests / check-licenses (pull_request) Successful in 55s
				
			Run unit tests / copyright_notice (pull_request) Successful in 1m16s
				
			Run unit tests / unit_tests (pull_request) Failing after 3m39s
				
			Run unit tests / build-static-assets (pull_request) Has been skipped
				
			
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # Copyright (C) 2024-2025 LibreWeddingPlanner contributors
 | |
| 
 | |
| # frozen_string_literal: true
 | |
| 
 | |
| # == Schema Information
 | |
| #
 | |
| # Table name: guests
 | |
| #
 | |
| #  id            :uuid             not null, primary key
 | |
| #  name          :string
 | |
| #  phone         :string
 | |
| #  status        :integer          default("considered")
 | |
| #  created_at    :datetime         not null
 | |
| #  updated_at    :datetime         not null
 | |
| #  group_id      :uuid
 | |
| #  invitation_id :uuid
 | |
| #  wedding_id    :uuid             not null
 | |
| #
 | |
| # Indexes
 | |
| #
 | |
| #  index_guests_on_group_id       (group_id)
 | |
| #  index_guests_on_invitation_id  (invitation_id)
 | |
| #  index_guests_on_wedding_id     (wedding_id)
 | |
| #
 | |
| # Foreign Keys
 | |
| #
 | |
| #  fk_rails_...  (group_id => groups.id)
 | |
| #  fk_rails_...  (invitation_id => invitations.id)
 | |
| #  fk_rails_...  (wedding_id => weddings.id) ON DELETE => cascade
 | |
| #
 | |
| class Guest < ApplicationRecord
 | |
|   acts_as_tenant :wedding
 | |
|   belongs_to :group, optional: true
 | |
|   belongs_to :invitation, optional: true
 | |
| 
 | |
|   enum :status, {
 | |
|     considered: 0,
 | |
|     invited: 10,
 | |
|     confirmed: 20,
 | |
|     declined: 30,
 | |
|     tentative: 40
 | |
|   }, validate: true
 | |
| 
 | |
|   validates :name, presence: true
 | |
| 
 | |
|   scope :potential, -> { where.not(status: %i[declined considered]) }
 | |
| 
 | |
|   has_many :seats, dependent: :delete_all
 | |
| end
 |