From 280149222279ff5b830a1b5bb5ee964cfe9d287b Mon Sep 17 00:00:00 2001 From: Aron Wolf Date: Thu, 3 Feb 2022 12:36:59 +0100 Subject: [PATCH] Make the same request independently of the order that the models are loaded Currently, the order of the index in a search request changes with the order that the models are loaded. Problem: This does not matter for real request but makes problems with mocks (E.g. VCR gem) on tests when the order of the tests changes. --- elasticsearch-model/lib/elasticsearch/model/multimodel.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticsearch-model/lib/elasticsearch/model/multimodel.rb b/elasticsearch-model/lib/elasticsearch/model/multimodel.rb index 6b5fc2a8..8e816d2d 100644 --- a/elasticsearch-model/lib/elasticsearch/model/multimodel.rb +++ b/elasticsearch-model/lib/elasticsearch/model/multimodel.rb @@ -42,7 +42,7 @@ def self.add(klass) # Returns an Array of registered models # def self.all - __instance.models + __instance.models.sort_by(&:name) end # Adds a model to the registry