Created
August 12, 2019 18:04
-
-
Save tiagomatos/0804f7a8cec1a7bc5ae90705df3d6fc3 to your computer and use it in GitHub Desktop.
Duplicated Products (via SKU / name comparison)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
store = Store.find_by(code: "XXX") | |
store.products.all.each do |product| | |
p "product id: #{product.id} SKU duplicated from #{store.products.where(sku: product.sku).map(&:id)}" if store.products.where(sku: product.sku).size >= 2 | |
p "product id: #{product.id} name duplicated from #{store.products.where(name: product.name).map(&:id)}" if store.products.where(name: product.name).size >= 2 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment