Convert models to use new search includes mechanism
This commit is contained in:
@@ -48,10 +48,6 @@ class WikiPage < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def tag_matches(params)
|
||||
where(title: Tag.search(params).select(:name).reorder(nil))
|
||||
end
|
||||
|
||||
def linked_to(title)
|
||||
where(dtext_links: DtextLink.wiki_page.wiki_link.where(link_target: normalize_title(title)))
|
||||
end
|
||||
@@ -78,10 +74,6 @@ class WikiPage < ApplicationRecord
|
||||
q = q.other_names_match(params[:other_names_match])
|
||||
end
|
||||
|
||||
if params[:tag].present?
|
||||
q = q.tag_matches(params[:tag])
|
||||
end
|
||||
|
||||
if params[:linked_to].present?
|
||||
q = q.linked_to(params[:linked_to])
|
||||
end
|
||||
@@ -245,6 +237,14 @@ class WikiPage < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.model_restriction(table)
|
||||
super.where(table[:is_deleted].eq(false))
|
||||
end
|
||||
|
||||
def self.searchable_includes
|
||||
[:tag, :artist, :dtext_links]
|
||||
end
|
||||
|
||||
def self.available_includes
|
||||
[:tag, :artist, :dtext_links]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user