From ecbb6ef3e651cde7754be4d32b09d9d9d2dd0514 Mon Sep 17 00:00:00 2001 From: Martin Streicher Date: Mon, 4 Mar 2024 11:06:38 -0500 Subject: [PATCH] Ensure subclasses are added to the registry --- elasticsearch-model/lib/elasticsearch/model.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/elasticsearch-model/lib/elasticsearch/model.rb b/elasticsearch-model/lib/elasticsearch/model.rb index af2f34cb6..849c5c4f0 100644 --- a/elasticsearch-model/lib/elasticsearch/model.rb +++ b/elasticsearch-model/lib/elasticsearch/model.rb @@ -114,6 +114,11 @@ class << self METHODS.each do |method| delegate method, to: :__elasticsearch__ unless self.public_instance_methods.include?(method) end + + def inherited(subclass) + super + Registry.add(subclass) if subclass.is_a?(Class) + end end end