From 4b0d7acabe55fc54c413320a3ace68709a1efda2 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Mon, 12 Jun 2017 17:53:39 +0200 Subject: [PATCH] Fix search when viewing only assigned repository records [SCI-1342] --- app/datatables/repository_datatable.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/app/datatables/repository_datatable.rb b/app/datatables/repository_datatable.rb index a5bc29e07..175d9ec54 100644 --- a/app/datatables/repository_datatable.rb +++ b/app/datatables/repository_datatable.rb @@ -138,20 +138,23 @@ class RepositoryDatatable < AjaxDatatablesRails::Base # after that "data" function will return json def get_raw_records repository_rows = RepositoryRow - .includes( + .preload( :repository_columns, - :created_by - # repository_cells: :value - ).references( - :repository_columns, - :created_by + :created_by, + repository_cells: :value ) + .joins(:created_by) .where(repository: @repository) if @my_module - @assigned_rows = @my_module - .repository_rows - .where(repository: @repository) + @assigned_rows = @my_module.repository_rows + .preload( + :repository_columns, + :created_by, + repository_cells: :value + ) + .joins(:created_by) + .where(repository: @repository) end # Make mappings of custom columns, so we have same id for every column