+
+ def check_relations
+ current_names = self.publication_names
+ non_existant = []
+
+ pubs = Publication.find_all_by_name(current_names).map {|i| i.name}
+ missing = current_names.select {|name| not pubs.include?name }
+
+ if not missing.empty?
+ errors.add("publications", "Missing publication(s): " + missing.join(', '))
+ end
+ end
+
+ def update_relations
+ old = self.publications
+ current_names = self.publication_names
+ Rails.logger.info('[INFO] Updating relations: old= ' << old.inspect << ' current=' << current_names.inspect)