From b0a5206b296ea35726e0d58828084f1f3c7bafa1 Mon Sep 17 00:00:00 2001 From: Arkadiy Zabazhanov Date: Sat, 23 Apr 2016 08:15:14 +0700 Subject: [PATCH] Optimize grouped_objects method (#376) --- lib/chewy/type/adapter/orm.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/chewy/type/adapter/orm.rb b/lib/chewy/type/adapter/orm.rb index 5393945b6..d5f235675 100644 --- a/lib/chewy/type/adapter/orm.rb +++ b/lib/chewy/type/adapter/orm.rb @@ -150,6 +150,10 @@ def load_scope_objects(scope, additional_scope = nil) scope end end + + def grouped_objects(objects) + options[:delete_if] ? super : { index: objects.to_a } + end end end end