Hound is Love, Hound is Life

This commit is contained in:
Luka Murn 2017-07-04 14:47:58 +02:00
parent 91cddce8a6
commit 8d68769d09

View file

@ -669,9 +669,9 @@ class Protocol < ApplicationRecord
def update_linked_children
# Increment/decrement the parent's nr of linked children
if self.saved_change_to_parent_id?
if self.parent_id_before_last_save != nil
p = Protocol.find_by_id(self.parent_id_before_last_save)
if saved_change_to_parent_id?
unless parent_id_before_last_save.nil?
p = Protocol.find_by_id(parent_id_before_last_save)
p.record_timestamps = false
p.decrement!(:nr_of_linked_children)
end