From 03f6941cadf412f41e409fd7b5079312abb9788c Mon Sep 17 00:00:00 2001 From: Sam Lucidi Date: Tue, 6 Jun 2017 16:33:59 -0400 Subject: [PATCH] Return an empty relation instead of an array from db_relation() db_relation() returns an empty array if it couldn't determine another relation to use. This empty array doesn't work with chained activerecord methods like find_each, and breaks functions like populate_db_data_index! --- app/models/manager_refresh/inventory_collection.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/manager_refresh/inventory_collection.rb b/app/models/manager_refresh/inventory_collection.rb index b2821461fdb..f976663d67f 100644 --- a/app/models/manager_refresh/inventory_collection.rb +++ b/app/models/manager_refresh/inventory_collection.rb @@ -938,7 +938,7 @@ def db_relation(selection = nil, projection = nil) rel end - relation || [] + relation || model_class.none end # Extracting references to a relation friendly format, or a format processable by a custom_db_finder