searchable: refactor searchable_includes.

Pass searchable associations directly to search_attributes instead of
defining them separately in searchable_includes.
This commit is contained in:
evazion
2020-12-16 22:43:18 -06:00
parent e771c0fca8
commit ee4516f5fe
38 changed files with 46 additions and 185 deletions

View File

@@ -86,7 +86,7 @@ class ForumTopic < ApplicationRecord
end
def search(params)
q = search_attributes(params, :id, :created_at, :updated_at, :is_sticky, :is_locked, :is_deleted, :category_id, :title, :response_count)
q = search_attributes(params, :id, :created_at, :updated_at, :is_sticky, :is_locked, :is_deleted, :category_id, :title, :response_count, :creator, :updater, :forum_posts, :bulk_update_requests, :tag_aliases, :tag_implications)
q = q.text_attribute_matches(:title, params[:title_matches], index_column: :text_index)
if params[:is_private].to_s.truthy?
@@ -189,10 +189,6 @@ class ForumTopic < ApplicationRecord
title.gsub(/\A\[APPROVED\]|\[REJECTED\]/, "")
end
def self.searchable_includes
[:creator, :updater, :forum_posts, :bulk_update_requests, :tag_aliases, :tag_implications]
end
def self.available_includes
[:creator, :updater, :original_post]
end