Been stuck on this for some time as I have tried things like .uniq and .map but my issue is as follows:
I have @products which make up all the products in the inventory for my store.
@products also have variations through size, color, etc where I can control stock, etc.
the unique part of @products is the product.sku
Ideally I need to display the product just once based on sku.
Any help would be appreciated.
UPDATE: I tried the answer below as such and it did not work:
@products = Shoppe::Product.where(product_category_id: 1)
puts "####################################################"
puts @products.count
puts "####################################################"
@products = @products.uniq { |product| product.sku }
puts "####################################################"
puts @products.count
puts "####################################################"
The counts return the same