From 3d2d0d5fe517efa7c149ab4afc8c0ed5157b4da3 Mon Sep 17 00:00:00 2001 From: Vincent Emonet Date: Thu, 8 Dec 2016 14:18:22 +0100 Subject: [PATCH] fix a bug where slices were created by downcasing groups acronym. But when trying to retrieve them to update them, the groups acronym were not downcased so the slices were not found --- lib/ontologies_linked_data/models/slice.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ontologies_linked_data/models/slice.rb b/lib/ontologies_linked_data/models/slice.rb index 65748f2e..a25c029c 100644 --- a/lib/ontologies_linked_data/models/slice.rb +++ b/lib/ontologies_linked_data/models/slice.rb @@ -21,11 +21,11 @@ def self.validate_acronym(inst, attr) return [:acronym_value_validator, nil] end + # Check to make sure each group has a corresponding slice (and ontologies match) def self.synchronize_groups_to_slices - # Check to make sure each group has a corresponding slice (and ontologies match) groups = LinkedData::Models::Group.where.include(LinkedData::Models::Group.attributes(:all)).all groups.each do |g| - slice = self.find(g.acronym).include(LinkedData::Models::Slice.attributes(:all)).first + slice = self.find(g.acronym.downcase.gsub(" ", "_")).include(LinkedData::Models::Slice.attributes(:all)).first if slice slice.ontologies = g.ontologies slice.save if slice.valid?