Update ordergroup prices in OrderArticles via Order. Should fix bennibu#112.

This commit is contained in:
Robert Waltemath 2013-05-30 10:54:22 +02:00 committed by wvengen
parent 043fc6391c
commit 82fb6d1dbe

View file

@ -148,7 +148,10 @@ class OrderArticle < ActiveRecord::Base
end
def update_ordergroup_prices
group_order_articles.each { |goa| goa.group_order.update_price! }
# updates prices of ALL ordergroups - these are actually too many
# in case of performance issues, update only ordergroups, which ordered this article
# CAUTION: in after_destroy callback related records (e.g. group_order_articles) are already non-existent
order.group_orders.each { |go| go.update_price! }
end
end