From e058adab089fbde5af63c62fb309f4df940cefa4 Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Mon, 17 May 2021 09:55:59 +0200 Subject: [PATCH] Add search scope from searchable concern [SCI-5551] --- app/datatables/report_datatable.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/datatables/report_datatable.rb b/app/datatables/report_datatable.rb index 4e4e11e11..724acdb82 100644 --- a/app/datatables/report_datatable.rb +++ b/app/datatables/report_datatable.rb @@ -104,8 +104,10 @@ class ReportDatatable < CustomDatatable end def filter_records(records) - records.where('project_name ILIKE :q OR reports.name ILIKE :q OR reports.description ILIKE :q', - { q: "%#{dt_params.dig(:search, :value)}%" }) + records.where_attributes_like( + ['project_name', 'reports.name', 'reports.description'], + dt_params.dig(:search, :value) + ) end # ==== Insert 'presenter'-like methods below if necessary