Class: SchedulerBookingQuestion
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- SchedulerBookingQuestion
- Defined in:
- app/models/scheduler_booking_question.rb
Overview
== Schema Information
Table name: scheduler_booking_questions
Database name: primary
id :bigint not null, primary key
active :boolean default(TRUE), not null
field_type :string default("short_text"), not null
label :string not null
position :integer default(0), not null
required :boolean default(FALSE), not null
created_at :datetime not null
updated_at :datetime not null
scheduler_booking_page_id :bigint not null
Indexes
idx_scheduler_questions_page_position (scheduler_booking_page_id,position)
Foreign Keys
fk_rails_... (scheduler_booking_page_id => scheduler_booking_pages.id) ON DELETE => cascade
Constant Summary
Constants included from Models::Schedulable
Models::Schedulable::SIMPLE_FORM_OPTIONS
Instance Attribute Summary collapse
-
#field_type ⇒ String
Input control type (
short_textorlong_text). -
#label ⇒ String
Question text shown to the user.
-
#position ⇒ Integer
Display order on the booking page.
Belongs to collapse
Class Method Summary collapse
-
.active ⇒ ActiveRecord::Relation<SchedulerBookingQuestion>
A relation of SchedulerBookingQuestions that are active.
-
.ordered ⇒ ActiveRecord::Relation<SchedulerBookingQuestion>
A relation of SchedulerBookingQuestions that are ordered.
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::Schedulable
Methods included from Models::AfterCommittable
Methods included from Models::EventPublishable
Instance Attribute Details
#field_type ⇒ String
Returns Input control type (short_text or long_text).
35 |
# File 'app/models/scheduler_booking_question.rb', line 35 validates :field_type, presence: true, inclusion: { in: %w[short_text long_text] } |
#label ⇒ String
Returns Question text shown to the user.
32 |
# File 'app/models/scheduler_booking_question.rb', line 32 validates :label, presence: true |
#position ⇒ Integer
Returns Display order on the booking page.
38 |
# File 'app/models/scheduler_booking_question.rb', line 38 validates :position, numericality: { only_integer: true, greater_than_or_equal_to: 0 } |
Class Method Details
.active ⇒ ActiveRecord::Relation<SchedulerBookingQuestion>
A relation of SchedulerBookingQuestions that are active. Active Record Scope
40 |
# File 'app/models/scheduler_booking_question.rb', line 40 scope :active, -> { where(active: true) } |
.ordered ⇒ ActiveRecord::Relation<SchedulerBookingQuestion>
A relation of SchedulerBookingQuestions that are ordered. Active Record Scope
41 |
# File 'app/models/scheduler_booking_question.rb', line 41 scope :ordered, -> { order(:position) } |
Instance Method Details
#scheduler_booking_page ⇒ SchedulerBookingPage
28 |
# File 'app/models/scheduler_booking_question.rb', line 28 belongs_to :scheduler_booking_page |