|
|
|
@ -62,7 +62,7 @@ class Course < ApplicationRecord
|
|
|
|
|
scope :hidden, ->(is_hidden = true) { where(is_hidden: is_hidden) }
|
|
|
|
|
scope :ended, ->(is_end = true) { where(is_end: is_end) }
|
|
|
|
|
scope :processing, -> { where(is_end: false) }
|
|
|
|
|
scope :not_deleted, -> { where(is_delete: false) }
|
|
|
|
|
scope :not_deleted, -> { where(is_delete: 0) }
|
|
|
|
|
scope :deleted, ->(is_delete = 1) { where(is_delete: is_delete) }
|
|
|
|
|
scope :by_user, ->(user) { joins(:course_members).where('course_members.user_id = ?', user.id).order(updated_at: :desc) }
|
|
|
|
|
scope :by_keywords, lambda { |keywords|
|
|
|
|
|