Fix #3696: API: handle boolean params consistently

* Use ApplicationRecord#attribute_matches to handle boolean attributes
  consistently in search methods.

* Add support for searching various boolean attributes that previously
  weren't supported.
This commit is contained in:
evazion
2018-05-03 15:29:43 -05:00
parent c7492343ce
commit 216d735f24
15 changed files with 60 additions and 75 deletions

View File

@@ -92,6 +92,9 @@ class WikiPage < ApplicationRecord
q = q.where("other_names is null or other_names = ''")
end
q = q.attribute_matches(:is_locked, params[:is_locked])
q = q.attribute_matches(:is_deleted, params[:is_deleted])
params[:order] ||= params.delete(:sort)
case params[:order]
when "title"