Skip to content

Commit

Permalink
fix #127, delete provisionalClasses on ontology delete
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Feb 10, 2022
1 parent 735ffbb commit c72134f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 1 addition & 6 deletions lib/ontologies_linked_data/models/ontology.rb
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,7 @@ def delete(*args)
self.bring(:provisionalClasses)
unless self.provisionalClasses.nil?
self.provisionalClasses.each do |p|
p.bring(:ontology)
p.bring_remaining
onts = p.ontology
onts.select! {|x| x.id != self.id}
p.ontology = onts
p.save()
p.delete
end
end

Expand Down
7 changes: 6 additions & 1 deletion test/models/test_ontology.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,16 @@ def test_ontology_delete
u, of, contact = ontology_objects()
o1 = ontologies[0]
o2 = ontologies[1]

pc = LinkedData::Models::ProvisionalClass.new({label: "Test Provisional Class", creator: u, ontology: o1})
pc.save
n = LinkedData::Models::Note.new({
creator: u,
relatedOntology: [o1]
})
assert pc.valid?
pc.save
assert_equal true, pc.exist?(reload=true)

assert n.valid?
n.save()
assert_equal true, n.exist?(reload=true)
Expand Down

0 comments on commit c72134f

Please sign in to comment.