models: refactor class methods into scopes.

This commit is contained in:
evazion
2020-02-17 02:10:08 -06:00
parent 9a8aa1990d
commit 83a0cb0a71
12 changed files with 45 additions and 126 deletions

View File

@@ -31,6 +31,8 @@ class ForumTopic < ApplicationRecord
ModAction.log("locked forum topic ##{id} (title: #{title})", :forum_topic_lock)
end
scope :active, -> { where(is_deleted: false) }
module CategoryMethods
extend ActiveSupport::Concern
@@ -50,10 +52,6 @@ class ForumTopic < ApplicationRecord
end
module SearchMethods
def active
where(is_deleted: false)
end
def permitted
where("min_level <= ?", CurrentUser.level)
end