Class: TopicExam
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- TopicExam
- Defined in:
- app/models/topic_exam.rb
Overview
== Schema Information
Table name: topic_exams
Database name: primary
id :bigint not null, primary key
active :boolean default(FALSE), not null
applies_to_customers :boolean default(FALSE), not null
applies_to_employees :boolean default(FALSE), not null
description :text
min_score_to_pass :integer
name :string not null
position :integer
training_module :boolean default(FALSE), not null
course_id :integer not null
topic_category_id :integer
Foreign Keys
fk_rails_... (topic_category_id => topic_categories.id)
Instance Attribute Summary collapse
- #min_score_to_pass ⇒ Object readonly
Belongs to collapse
Has many collapse
Class Method Summary collapse
-
.active ⇒ ActiveRecord::Relation<TopicExam>
A relation of TopicExams that are active.
- .select_options ⇒ Object
-
.sorted ⇒ ActiveRecord::Relation<TopicExam>
A relation of TopicExams that are sorted.
Instance Method Summary collapse
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Instance Attribute Details
#min_score_to_pass ⇒ Object (readonly)
36 |
# File 'app/models/topic_exam.rb', line 36 validates :min_score_to_pass, presence: true |
Class Method Details
.active ⇒ ActiveRecord::Relation<TopicExam>
A relation of TopicExams that are active. Active Record Scope
33 |
# File 'app/models/topic_exam.rb', line 33 scope :active, -> { where(active: true) } |
.select_options ⇒ Object
38 39 40 |
# File 'app/models/topic_exam.rb', line 38 def self. order(:name).map{|te| [te.to_s, te.id]} end |
.sorted ⇒ ActiveRecord::Relation<TopicExam>
A relation of TopicExams that are sorted. Active Record Scope
34 |
# File 'app/models/topic_exam.rb', line 34 scope :sorted, -> { order(:position) } |
Instance Method Details
#customer_topics ⇒ ActiveRecord::Relation<CustomerTopic>
27 |
# File 'app/models/topic_exam.rb', line 27 has_many :customer_topics |
#to_s ⇒ Object
42 43 44 |
# File 'app/models/topic_exam.rb', line 42 def to_s name end |
#topics ⇒ ActiveRecord::Relation<Topic>
26 |
# File 'app/models/topic_exam.rb', line 26 has_many :topics, -> { order(:position) }, inverse_of: :topic_exam |