Update ordergroup prices in OrderArticles via Order. Should fix bennibu#112.
This commit is contained in:
parent
043fc6391c
commit
82fb6d1dbe
1 changed files with 4 additions and 1 deletions
|
@ -148,7 +148,10 @@ class OrderArticle < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_ordergroup_prices
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue