2025-01-13 20:38:47 +00:00
|
|
|
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
|
2025-01-13 21:37:02 +01:00
|
|
|
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
2024-10-27 21:42:45 +00:00
|
|
|
|
2024-12-28 18:37:47 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-11-13 08:12:46 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: tables_arrangements
|
|
|
|
#
|
|
|
|
# id :uuid not null, primary key
|
|
|
|
# discomfort :integer
|
|
|
|
# name :string not null
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
2024-11-30 20:04:17 +01:00
|
|
|
# wedding_id :uuid not null
|
|
|
|
#
|
|
|
|
# Indexes
|
|
|
|
#
|
|
|
|
# index_tables_arrangements_on_wedding_id (wedding_id)
|
|
|
|
#
|
|
|
|
# Foreign Keys
|
|
|
|
#
|
|
|
|
# fk_rails_... (wedding_id => weddings.id)
|
2024-11-13 08:12:46 +00:00
|
|
|
#
|
2024-08-01 18:27:41 +00:00
|
|
|
class TablesArrangement < ApplicationRecord
|
2024-11-30 20:04:17 +01:00
|
|
|
acts_as_tenant :wedding
|
2024-12-28 18:13:57 +01:00
|
|
|
has_many :seats, dependent: :delete_all
|
2024-11-02 10:40:43 +01:00
|
|
|
has_many :guests, through: :seats
|
2024-11-03 08:44:31 +01:00
|
|
|
|
|
|
|
before_create :assign_name
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def assign_name
|
|
|
|
self.name = "#{Faker::Adjective.positive} #{Faker::Creature::Animal.name}".capitalize
|
|
|
|
end
|
2024-08-01 18:27:41 +00:00
|
|
|
end
|