From 49c1203ea80042db64e1fa99ea3481ac75a69fa9 Mon Sep 17 00:00:00 2001 From: jrgriffiniii Date: Tue, 27 Sep 2022 01:37:46 -0400 Subject: [PATCH] [wip] Ensuring that deduplication exists for certain cases --- lib/active_fedora/core.rb | 5 ++++- lib/active_fedora/orders/ordered_list.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/active_fedora/core.rb b/lib/active_fedora/core.rb index a07bacb17..dd8e2820b 100644 --- a/lib/active_fedora/core.rb +++ b/lib/active_fedora/core.rb @@ -79,7 +79,10 @@ def load_proxy_associations if child_reflection.klass == proxy.class ordered_association = association(r.name) #ordered_association.add_to_target(proxy) - ordered_association.target.append_target(proxy) + #binding.pry + if !ordered_association.target_reader.to_a.include?(proxy) + ordered_association.target.append_target(proxy) + end end end end diff --git a/lib/active_fedora/orders/ordered_list.rb b/lib/active_fedora/orders/ordered_list.rb index 39d2d4ef8..ce5ec177c 100644 --- a/lib/active_fedora/orders/ordered_list.rb +++ b/lib/active_fedora/orders/ordered_list.rb @@ -6,7 +6,7 @@ module Orders class OrderedList include Enumerable attr_reader :graph, :head_subject, :tail_subject - attr_writer :head, :tail + attr_writer :head, :tail, :changed delegate :each, to: :ordered_reader delegate :length, to: :to_a # @param [::RDF::Enumerable] graph Enumerable where ORE statements are