spree-contrib / spree_related_products

Related products extension for Spree Commerce.
http://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
149 stars 241 forks source link

Deleted products are still showing up in related products list #81

Closed brchristian closed 10 years ago

brchristian commented 10 years ago

I notice that if I delete a product, it still shows up in "related products" lists that had included that product. I would expect that either (a) deleting a product would trigger deletion of its inbound recommendations, and/or (b) viewing of a recommendation for a deleted product would be suppressed.

radar commented 10 years ago

My guess is that this is going to be as simple as adding a dependent: destroy option to the has_many :relations association in the Product model. Can you try to do that and confirm for me if that works?

piton4eg commented 10 years ago

I have a similar problem when I try to delete related product in admin panel - relation deleted but in view I still see it. In my situation problem was in redirect back after delete relation - view with related products wasn't update. I commented redirect_to :back in RelationsController, it helped me

radar commented 10 years ago

@brchristian or @piton4eg Did you try my suggestion as above?

brchristian commented 10 years ago

I haven't looked into it yet, but can have a look in the next 24 hours and get back to you. What you suggest seems totally sensible, and I'm optimistic.