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