Skip to content

Commit 77358d4

Browse files
committed
[MODEL] Added proper delegation to proxy method from the including model
1 parent c3da11e commit 77358d4

File tree

1 file changed

+12
-4
lines changed
  • elasticsearch-model/lib/elasticsearch

1 file changed

+12
-4
lines changed

elasticsearch-model/lib/elasticsearch/model.rb

+12-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ def self.included(base)
9393
# Delegate important methods to the `__elasticsearch__` proxy, unless they are defined already
9494
#
9595
extend Support::Forwardable
96-
forward :'self.__elasticsearch__', :search unless respond_to?(:search)
97-
forward :'self.__elasticsearch__', :mapping unless respond_to?(:mapping)
98-
forward :'self.__elasticsearch__', :settings unless respond_to?(:settings)
99-
forward :'self.__elasticsearch__', :import unless respond_to?(:import)
96+
forward :'self.__elasticsearch__', :search unless respond_to?(:search)
97+
forward :'self.__elasticsearch__', :mapping unless respond_to?(:mapping)
98+
forward :'self.__elasticsearch__', :mappings unless respond_to?(:mappings)
99+
forward :'self.__elasticsearch__', :settings unless respond_to?(:settings)
100+
forward :'self.__elasticsearch__', :index_name unless respond_to?(:index_name)
101+
forward :'self.__elasticsearch__', :document_type unless respond_to?(:document_type)
102+
forward :'self.__elasticsearch__', :import unless respond_to?(:import)
103+
104+
instance_delegate [:as_indexed_json] => :__elasticsearch__
105+
instance_delegate [:index_document] => :__elasticsearch__
106+
instance_delegate [:update_document] => :__elasticsearch__
107+
instance_delegate [:delete_document] => :__elasticsearch__
100108

101109
# Mix the importing module into the proxy
102110
#

0 commit comments

Comments
 (0)