lib/perus/server/models/group.rb in perus-0.1.2 vs lib/perus/server/models/group.rb in perus-0.1.3

- old
+ new

@@ -6,7 +6,19 @@ def validate super validates_presence :name validates_unique :name end + + def after_destroy + super + + # rather than deleting all systems in a group, each system in the + # group is just removed from the group instead. this is better than + # accidentally removing a group and all related system data. + systems.each do |system| + system.group_id = nil + system.save + end + end end end