Update ordergroup prices in OrderArticles via Order. Should fix bennibu#112.
This commit is contained in:
parent
53518039f1
commit
2a1176c31a
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue