Set up association and models
This commit is contained in:
parent
a1ce39643b
commit
c9ae859bcf
5 changed files with 32 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ class Booth < ApplicationRecord
|
|||
attr_accessor :invite_responsible
|
||||
|
||||
belongs_to :conference
|
||||
belongs_to :booth_type
|
||||
has_many :booth_requests, dependent: :destroy
|
||||
has_many :users, through: :booth_requests
|
||||
|
||||
|
|
|
|||
17
app/models/booth_type.rb
Normal file
17
app/models/booth_type.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class BoothType < ApplicationRecord
|
||||
belongs_to :program, touch: true
|
||||
has_many :booths, dependent: :restrict_with_error
|
||||
|
||||
has_paper_trail meta: { conference_id: :conference_id },
|
||||
ignore: %i[updated_at]
|
||||
|
||||
validates :title, presence: true
|
||||
|
||||
private
|
||||
|
||||
def conference_id
|
||||
program.conference_id
|
||||
end
|
||||
end
|
||||
|
|
@ -52,6 +52,7 @@ class Conference < ApplicationRecord
|
|||
through: :program,
|
||||
source: :events
|
||||
has_many :event_types, through: :program
|
||||
has_many :booth_types, through: :program
|
||||
|
||||
has_many :surveys, as: :surveyable, dependent: :destroy do
|
||||
def for_registration
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class Program < ApplicationRecord
|
|||
|
||||
has_many :cfps, dependent: :destroy
|
||||
has_many :event_types, dependent: :destroy
|
||||
has_many :booth_types, dependent: :destroy
|
||||
has_many :tracks, dependent: :destroy
|
||||
has_many :difficulty_levels, dependent: :destroy
|
||||
has_many :schedules, dependent: :destroy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue