Class: Course
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Course
- Extended by:
- FriendlyId
- Includes:
- Models::Auditable, Models::LiquidMethods
- Defined in:
- app/models/course.rb
Overview
+----------+ +---------------+ +-------+ +---------+
| | 1 * | | 1 * | | 1 * | |
| Course +-----+ TopicCategory +-----+ Topic +-----+ Article |
| | | (Module) | | | | |
+----------+ +---------------+ +-------+ +---------+
== Schema Information
Table name: courses
Database name: primary
id :bigint not null, primary key
active :boolean default(TRUE)
description :text
duration :string
name :string not null
slug :string
created_at :datetime not null
updated_at :datetime not null
creator_id :integer
updater_id :integer
Indexes
index_courses_on_slug (slug) UNIQUE
Constant Summary
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Instance Attribute Summary collapse
- #name ⇒ Object readonly
Has many collapse
- #course_enrollments ⇒ ActiveRecord::Relation<CourseEnrollment>
- #party_topics ⇒ ActiveRecord::Relation<PartyTopic>
- #topic_categories ⇒ ActiveRecord::Relation<TopicCategory>
- #topic_exams ⇒ ActiveRecord::Relation<TopicExam>
Class Method Summary collapse
-
.active ⇒ ActiveRecord::Relation<Course>
A relation of Courses that are active.
- .select_options(course_id: nil) ⇒ Object
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
Instance Attribute Details
#name ⇒ Object (readonly)
39 |
# File 'app/models/course.rb', line 39 validates :name, presence: true, uniqueness: true |
Class Method Details
.active ⇒ ActiveRecord::Relation<Course>
A relation of Courses that are active. Active Record Scope
43 |
# File 'app/models/course.rb', line 43 scope :active, -> { where(active: true) } |
.select_options(course_id: nil) ⇒ Object
45 46 47 |
# File 'app/models/course.rb', line 45 def self.(course_id: nil) Course.all.pluck(:name, :id) end |
Instance Method Details
#course_enrollments ⇒ ActiveRecord::Relation<CourseEnrollment>
36 |
# File 'app/models/course.rb', line 36 has_many :course_enrollments |
#party_topics ⇒ ActiveRecord::Relation<PartyTopic>
37 |
# File 'app/models/course.rb', line 37 has_many :party_topics |
#topic_categories ⇒ ActiveRecord::Relation<TopicCategory>
34 |
# File 'app/models/course.rb', line 34 has_many :topic_categories |
#topic_exams ⇒ ActiveRecord::Relation<TopicExam>
35 |
# File 'app/models/course.rb', line 35 has_many :topic_exams |