File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
lib/elasticsearch/model/adapters Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,10 @@ def order(*args)
5656 # Redefine the `to_a` method to the original one
5757 #
5858 sql_records . instance_exec do
59- define_singleton_method ( :to_a ) do
59+ ar_records_method_name = :to_a
60+ ar_records_method_name = :records if defined? ( ::ActiveRecord ) && ::ActiveRecord ::VERSION ::MAJOR >= 5
61+
62+ define_singleton_method ( ar_records_method_name ) do
6063 if defined? ( ::ActiveRecord ) && ::ActiveRecord ::VERSION ::MAJOR >= 4
6164 self . load
6265 else
Original file line number Diff line number Diff line change @@ -223,8 +223,10 @@ def as_indexed_json(options = {})
223223
224224 if defined? ( ::ActiveRecord ) && ::ActiveRecord ::VERSION ::MAJOR >= 4
225225 assert_equal 'Testing Coding' , response . records . order ( title : :desc ) . first . title
226+ assert_equal 'Testing Coding' , response . records . order ( title : :desc ) [ 0 ] . title
226227 else
227228 assert_equal 'Testing Coding' , response . records . order ( 'title DESC' ) . first . title
229+ assert_equal 'Testing Coding' , response . records . order ( 'title DESC' ) [ 0 ] . title
228230 end
229231 end
230232
You can’t perform that action at this time.
0 commit comments