Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. store = Store.find_by(code: "XXX")
  2. store.products.all.each do |product|
  3. 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
  4. 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
  5. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement