Skip to content

Commit b6d4857

Browse files
committed
[MODEL] Use records.__send__ :load instead of records.load in the ActiveRecord adapter
This is to prevent the "private method load called for Array" exceptions in unit tests.
1 parent 40f9e7e commit b6d4857

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

elasticsearch-model/lib/elasticsearch/model/adapters/active_record.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def records
3636
self.__send__(:exec_queries)
3737
end
3838
@records.sort_by { |record| hits.index { |hit| hit['_id'].to_s == record.id.to_s } }
39-
end
39+
end if self
4040
end
4141

4242
sql_records
@@ -45,7 +45,7 @@ def records
4545
# Prevent clash with `ActiveSupport::Dependencies::Loadable`
4646
#
4747
def load
48-
records.load
48+
records.__send__(:load)
4949
end
5050

5151
# Intercept call to the `order` method, so we can ignore the order from Elasticsearch

0 commit comments

Comments
 (0)