diff --git a/CHANGELOG.md b/CHANGELOG.md index 0daf6e61c..0714cfa16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. This file should follow the standards specified on [http://keepachangelog.com/] This project adheres to [Semantic Versioning](http://semver.org/). +## [12.0.0.beta.1] 2024-01-01 + +## Added + +- removed deprecated usage of id (neo_id), replaced with element_id, requires neo4j-ruby-driver 5 +- removed the possibility of using neo_id as id_property +- added id_property to relationships + ## [11.5.0.beta.1] 2023-12-29 ## Added diff --git a/lib/active_graph/core/query_clauses.rb b/lib/active_graph/core/query_clauses.rb index 526131378..0ac7bd430 100644 --- a/lib/active_graph/core/query_clauses.rb +++ b/lib/active_graph/core/query_clauses.rb @@ -200,7 +200,7 @@ def range_key_value_string(key, value, previous_keys, param) end def array_value?(value, is_set) - value.is_a?(Array) && !is_set + value.is_a?(Enumerable) && !is_set end def format_label(label_arg) diff --git a/lib/active_graph/node/query/query_proxy/link.rb b/lib/active_graph/node/query/query_proxy/link.rb index 29b0b78a3..9a3ebb0a3 100644 --- a/lib/active_graph/node/query/query_proxy/link.rb +++ b/lib/active_graph/node/query/query_proxy/link.rb @@ -147,8 +147,8 @@ def new_for_key_and_value(model, key, value) val = if !model value - elsif key == model.id_property_name && value.is_a?(ActiveGraph::Node) - value.id + elsif key == model.id_property_name + try_id(value) else converted_value(model, key, value) end @@ -156,6 +156,17 @@ def new_for_key_and_value(model, key, value) new(:where, ->(v, _) { {v => {key => val}} }) end + private def try_id(value) + case value + when Shared::Identity + value.id + when Enumerable + value.map(&method(:try_id)) + else + value + end + end + def for_association(name, value, n_string, model) neo_id = value.try(:neo_id) || value fail ArgumentError, "Invalid value for '#{name}' condition" unless neo_id.is_a?(String) diff --git a/lib/active_graph/version.rb b/lib/active_graph/version.rb index 1c10eaeb9..4e23a4fe6 100644 --- a/lib/active_graph/version.rb +++ b/lib/active_graph/version.rb @@ -1,3 +1,3 @@ module ActiveGraph - VERSION = '11.5.0.beta.1' + VERSION = '12.0.0.beta.1' end diff --git a/spec/e2e/query_spec.rb b/spec/e2e/query_spec.rb index 459c9a272..c1eaa44fd 100644 --- a/spec/e2e/query_spec.rb +++ b/spec/e2e/query_spec.rb @@ -198,6 +198,10 @@ def self.ordered_by_subject it 'allows filtering and parametarizing by String and Hash in where' do expect(Teacher.as(:teach).where('teach.name =~ $name', name: '.*Othmar.*').to_a).to eq([othmar]) end + + it 'allows filtering by set' do + expect(Teacher.where(id: Set[samuels.id, othmar]).to_a).to include(samuels, othmar) + end end describe 'merge methods' do