Class: SchedulerHost

Inherits:
ApplicationRecord show all
Defined in:
app/models/scheduler_host.rb

Overview

== Schema Information

Table name: scheduler_hosts
Database name: primary

id :bigint not null, primary key
priority :integer default(0), not null
created_at :datetime not null
updated_at :datetime not null
employee_id :bigint not null
scheduler_booking_page_id :bigint not null

Indexes

idx_scheduler_hosts_page_employee (scheduler_booking_page_id,employee_id) UNIQUE
index_scheduler_hosts_on_employee_id (employee_id)

Foreign Keys

fk_rails_... (employee_id => parties.id) ON DELETE => cascade
fk_rails_... (scheduler_booking_page_id => scheduler_booking_pages.id) ON DELETE => cascade

Instance Attribute Summary collapse

Belongs to collapse

Class Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Instance Attribute Details

#employee_idObject (readonly)



28
# File 'app/models/scheduler_host.rb', line 28

validates :employee_id, uniqueness: { scope: :scheduler_booking_page_id, message: 'is already a host for this booking page' }

Class Method Details

.by_priorityActiveRecord::Relation<SchedulerHost>

A relation of SchedulerHosts that are by priority. Active Record Scope

Returns:

See Also:



30
# File 'app/models/scheduler_host.rb', line 30

scope :by_priority, -> { order(:priority) }

Instance Method Details

#employeeEmployee

Returns:

See Also:



26
# File 'app/models/scheduler_host.rb', line 26

belongs_to :employee

#scheduler_booking_pageSchedulerBookingPage



25
# File 'app/models/scheduler_host.rb', line 25

belongs_to :scheduler_booking_page