Add support for chaining more search includes

- A generalized search includes function was added
-- The post and user includes functions were changed to use that
- A search function for polymorphic includes was added
- All models are given 3 class functions to control which includes
  are searchable, and extra restrictions for the "has_" params
This commit is contained in:
BrokenEagle
2020-07-19 03:12:03 +00:00
parent c4fb43a5b4
commit c141a358bd
2 changed files with 101 additions and 15 deletions

View File

@@ -93,6 +93,22 @@ class ApplicationRecord < ActiveRecord::Base
end
end
concerning :SearchMethods do
class_methods do
def searchable_includes
[]
end
def model_restriction(table)
table.project(1)
end
def attribute_restriction(*)
all
end
end
end
concerning :ActiveRecordExtensions do
class_methods do
def without_timeout