spree-contrib / spree_related_products

Related products extension for Spree Commerce.

Home Page:http://guides.spreecommerce.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deleted products are still showing up in related products list

brchristian opened this issue · comments

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.

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?

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

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

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.