2N/A # There is no polymorphic has_one 2N/A first.try(:ontology) 2N/A LocId.where(locid: generate_locid_string, 58N/A specific_type: normalized_class.to_s).first_or_create! 2N/A # To be overwritten in the subclasses. 2N/A def generate_locid_string 23N/A # When reanalysing an ontology in the migrations (because of duplicates), 32N/A # the locid can already be nil. 32N/A loc_ids.first.try(:destroy) 34N/A loc_ids.first.try(:locid) 32N/A if locid = loc_ids.first 2N/A locid.update_attributes(locid: string) 38N/A LocId.create(specific_id: id, 38N/A specific_type: normalized_class.to_s, 38N/A def normalized_class 38N/A # Sometimes the objects are "Ontology" and sometimes a subclass. 83N/A if [DistributedOntology, SingleOntology].include?(self.class) 99N/A elsif Sentence.descendants.include?(self.class)