Convert models to use new search includes mechanism
This commit is contained in:
@@ -85,7 +85,7 @@ class ForumTopic < ApplicationRecord
|
||||
|
||||
def search(params)
|
||||
q = super
|
||||
q = q.search_attributes(params, :creator, :updater, :is_sticky, :is_locked, :is_deleted, :category_id, :title, :response_count)
|
||||
q = q.search_attributes(params, :is_sticky, :is_locked, :is_deleted, :category_id, :title, :response_count)
|
||||
q = q.text_attribute_matches(:title, params[:title_matches], index_column: :text_index)
|
||||
|
||||
if params[:is_private].to_s.truthy?
|
||||
@@ -190,6 +190,10 @@ class ForumTopic < ApplicationRecord
|
||||
super + [:is_read?]
|
||||
end
|
||||
|
||||
def self.searchable_includes
|
||||
[:creator, :updater, :forum_posts, :bulk_update_requests]
|
||||
end
|
||||
|
||||
def self.available_includes
|
||||
[:creator, :updater, :original_post]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user