mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Refresh cache when option type changed
This commit is contained in:
13
app/models/spree/option_type_decorator.rb
Normal file
13
app/models/spree/option_type_decorator.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
module Spree
|
||||
OptionType.class_eval do
|
||||
has_many :products, through: :product_option_types
|
||||
after_save :refresh_products_cache
|
||||
|
||||
|
||||
private
|
||||
|
||||
def refresh_products_cache
|
||||
products(:reload).each &:refresh_products_cache
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user