Convert models to use new search includes mechanism

This commit is contained in:
BrokenEagle
2020-07-19 03:42:51 +00:00
parent c141a358bd
commit c4009efccd
36 changed files with 208 additions and 125 deletions

View File

@@ -266,12 +266,6 @@ class Artist < ApplicationRecord
q = q.url_matches(params[:url_matches])
end
if params[:has_tag].to_s.truthy?
q = q.where(name: Tag.nonempty.select(:name))
elsif params[:has_tag].to_s.falsy?
q = q.where.not(name: Tag.nonempty.select(:name))
end
case params[:order]
when "name"
q = q.order("artists.name")
@@ -295,6 +289,14 @@ class Artist < ApplicationRecord
include BanMethods
extend SearchMethods
def self.model_restriction(table)
super.where(table[:is_deleted].eq(false))
end
def self.searchable_includes
[:urls, :wiki_page, :tag_alias, :tag]
end
def self.available_includes
[:members, :urls, :wiki_page, :tag_alias, :tag]
end