replaced deprecated method (search)

This commit is contained in:
dinsmol 2021-09-06 21:32:56 +03:00
parent e5e56b9de7
commit f9f74fa3e3
20 changed files with 26 additions and 26 deletions

View file

@ -26,14 +26,14 @@ class Registrar
end
normalize_search_parameters do
@q = domains.search(search_params.except(:contacts_ident_eq))
@q = domains.ransack(search_params.except(:contacts_ident_eq))
@domains = @q.result.page(params[:page])
# if we do not get any results, add wildcards to the name field and search again
if @domains.count == 0 && search_params[:name_matches] !~ /^%.+%$/
new_search_params = search_params.to_h.except(:contacts_ident_eq)
new_search_params[:name_matches] = "%#{new_search_params[:name_matches]}%"
@q = domains.search(new_search_params)
@q = domains.ransack(new_search_params)
@domains = @q.result.page(params[:page])
end
end