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

@@ -98,7 +98,7 @@ class Dmail < ApplicationRecord
def search(params)
q = super
q = q.search_attributes(params, :to, :from, :is_read, :is_deleted, :title, :body)
q = q.search_attributes(params, :is_read, :is_deleted, :title, :body)
q = q.text_attribute_matches(:title, params[:title_matches])
q = q.text_attribute_matches(:body, params[:message_matches], index_column: :message_index)
@@ -172,6 +172,10 @@ class Dmail < ApplicationRecord
key ? "dmail ##{id}/#{self.key}" : "dmail ##{id}"
end
def self.searchable_includes
[:to, :from]
end
def self.available_includes
[:owner, :to, :from]
end