Skip to content

Commit f71b888

Browse files
author
George Papanikolaou
committed
Fix existing methods override
Fix issue elastic#924 more: elastic#936
1 parent 5acfc78 commit f71b888

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

elasticsearch-model/lib/elasticsearch/model.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def self.included(base)
112112
# Delegate common methods to the `__elasticsearch__` ClassMethodsProxy, unless they are defined already
113113
class << self
114114
METHODS.each do |method|
115-
delegate method, to: :__elasticsearch__ unless self.respond_to?(method)
115+
delegate method, to: :__elasticsearch__ unless self.public_instance_methods.include?(method)
116116
end
117117
end
118118
end

elasticsearch-model/spec/elasticsearch/model/module_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def self.search(query, options={})
4747
end
4848
end
4949

50-
DummyIncludingModel.__send__ :include, Elasticsearch::Model
50+
DummyIncludingModelWithSearchMethodDefined.__send__ :include, Elasticsearch::Model
5151
end
5252

5353
after(:all) do

0 commit comments

Comments
 (0)