As of Rails 5, overriding `to_a` on an ActiveRecord collection does nothing. We need to override `records` instead. ref: cdd45fa09d
cdd45fa09d
extending
The `extending` method is the preferred way to add methods to an ActiveRecord collection. * http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-extending * https://ruby-doc.org/core-2.5.0/Object.html#method-i-extend