Permalink
Browse files

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

  • Loading branch information...
1 parent 39362ef commit 3c82585c9816de93e7ed8afbfd022818b22ac104 @paulcc committed Sep 22, 2009
Showing with 7 additions and 1 deletion.
  1. +7 −1 promotions_extension.rb
View
@@ -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

0 comments on commit 3c82585

Please sign in to comment.