Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

When product was marked as deleted, his promotions should be deleted.

  • Loading branch information...
commit 3c82585c9816de93e7ed8afbfd022818b22ac104 1 parent 39362ef
@paulcc authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 promotions_extension.rb
View
8 promotions_extension.rb
@@ -13,7 +13,13 @@ class PromotionsExtension < Spree::Extension
# end
def activate
- # admin.tabs.add "Promotions", "/admin/promotions", :after => "Layouts", :visibility => [:all]
+ Product.class_eval do
+ before_update :delete_promotions
+ private
+ def delete_promotions
+ Promotions.destroy_all(:product_id => id) if deleted_at
+ end
+ end
end
def deactivate
Please sign in to comment.
Something went wrong with that request. Please try again.