Class: Survey
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Survey
- Includes:
- ActiveModel::Validations, Models::Auditable
- Defined in:
- app/models/survey.rb
Overview
== Schema Information
Table name: surveys
Database name: primary
id :integer not null, primary key
active :boolean
applies_to_customers :boolean default(FALSE)
applies_to_employees :boolean default(FALSE)
description :text
intro_text :text
name :string
slug :string
training_module :boolean default(FALSE)
created_at :datetime not null
updated_at :datetime not null
creator_id :integer
updater_id :integer
Indexes
index_surveys_on_name (name)
Constant Summary
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Has many collapse
- #survey_enrollments ⇒ ActiveRecord::Relation<SurveyEnrollment>
- #topics ⇒ ActiveRecord::Relation<Topic>
Class Method Summary collapse
-
.active ⇒ ActiveRecord::Relation<Survey>
A relation of Surveys that are active.
- .select_options ⇒ Object
Instance Method Summary collapse
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #creator, #should_not_save_version, #stamp_record, #updater
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Class Method Details
.active ⇒ ActiveRecord::Relation<Survey>
A relation of Surveys that are active. Active Record Scope
32 |
# File 'app/models/survey.rb', line 32 scope :active, -> { where(active: true) } |
.select_options ⇒ Object
34 35 36 |
# File 'app/models/survey.rb', line 34 def self. order(:name).pluck(:name, :id) end |
Instance Method Details
#enrollemts_count ⇒ Object
38 39 40 |
# File 'app/models/survey.rb', line 38 def enrollemts_count survey_enrollments.size end |
#survey_enrollments ⇒ ActiveRecord::Relation<SurveyEnrollment>
30 |
# File 'app/models/survey.rb', line 30 has_many :survey_enrollments |