Skip to content

Commit

Permalink
Make scope compatible with Rails 6.1 + Ruby 3.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pcreux committed Sep 14, 2023
1 parent 6a311ce commit 06d4fe2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/neighbor/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def self.neighbor_attributes

return if @neighbor_attributes.size != 1

scope :nearest_neighbors, ->(attribute_name, vector = nil, distance:) {
scope :nearest_neighbors, ->(attribute_name, vector = nil, options) {
distance = options.fetch(:distance)
if vector.nil? && !attribute_name.nil? && attribute_name.respond_to?(:to_a)
vector = attribute_name
attribute_name = :neighbor_vector
Expand Down

0 comments on commit 06d4fe2

Please sign in to comment.