lib/search_flip/response.rb in search_flip-3.0.0.beta5 vs lib/search_flip/response.rb in search_flip-3.0.0.beta6

- old
+ new

@@ -220,10 +220,10 @@ # @example # CommentIndex.search("hello world").records # => [#<Comment ...>, ...] # # @return [Array] An array of database records - def records(options = {}) + def records @records ||= begin sort_map = ids.each_with_index.each_with_object({}) { |(id, index), hash| hash[id.to_s] = index } scope.to_a.sort_by { |record| sort_map[criteria.target.record_id(record).to_s] } end