When touching distributing enterprises, do not touch self -> infinite recursion

This commit is contained in:
Rohan Mitchell
2016-11-04 16:04:13 +11:00
parent dabac50128
commit 44a301edb1

View File

@@ -467,6 +467,8 @@ class Enterprise < ActiveRecord::Base
end
def touch_distributors
Enterprise.distributing_products(self.supplied_products).each(&:touch)
Enterprise.distributing_products(self.supplied_products).
where('enterprises.id != ?', self.id).
each(&:touch)
end
end