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

@@ -182,7 +182,7 @@ class Upload < ApplicationRecord
end
def self.search(params)
q = search_attributes(params, :id, :created_at, :updated_at, :source, :rating, :parent_id, :server, :md5, :server, :file_ext, :file_size, :image_width, :image_height, :referer_url)
q = search_attributes(params, :id, :created_at, :updated_at, :source, :rating, :parent_id, :server, :md5, :server, :file_ext, :file_size, :image_width, :image_height, :referer_url, :uploader, :post)
if params[:source_matches].present?
q = q.where_like(:source, params[:source_matches])
@@ -223,10 +223,6 @@ class Upload < ApplicationRecord
artist_commentary_title.present? || artist_commentary_desc.present? || translated_commentary_title.present? || translated_commentary_desc.present?
end
def self.searchable_includes
[:uploader, :post]
end
def self.available_includes
[:uploader, :post]
end