Fix #3430: Accept the search[id] param in all controllers.
* Allow every controller to take the `search[id]` param. * Parse the `search[id]` param the same way that the `id:<N>` metatag is parsed. So `search[id]=1,2,3`, `search[id]=<42`, `search[id]=1..10`, for example, are all accepted.
This commit is contained in:
@@ -50,17 +50,13 @@ class Pool < ApplicationRecord
|
||||
end
|
||||
|
||||
def search(params)
|
||||
q = where("true")
|
||||
q = super
|
||||
params = {} if params.blank?
|
||||
|
||||
if params[:name_matches].present?
|
||||
q = q.name_matches(params[:name_matches])
|
||||
end
|
||||
|
||||
if params[:id].present?
|
||||
q = q.where("pools.id in (?)", params[:id].split(","))
|
||||
end
|
||||
|
||||
if params[:description_matches].present?
|
||||
q = q.where("lower(pools.description) like ? escape E'\\\\'", "%" + params[:description_matches].mb_chars.downcase.to_escaped_for_sql_like + "%")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user