diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b555387..1034f37 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,8 @@ jobs: include: - ruby: 3.2 gemfile: gemfiles/activerecord71.gemfile + - ruby: 3.2 + gemfile: gemfiles/activerecord61.gemfile - ruby: 3.1 gemfile: Gemfile - ruby: "3.0" diff --git a/lib/neighbor/model.rb b/lib/neighbor/model.rb index 58e3e0a..621dcfa 100644 --- a/lib/neighbor/model.rb +++ b/lib/neighbor/model.rb @@ -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