I have an array with Product Ids and Color HEX Codes
Input:
@campaign.selectedproducts
Output:
["2,333333","1,333333",4,444444"]
I'm trying to make a new array with all of the product data by finding it with id:
@selectedgifts = @campaign.selectedproducts.collect [{|i| Product.find(i) }, |i| i.split(',').last]
Array should output
["Product Object, HEX code", "Product Object, HEX code"]
¿Any help?
Thanks!
{ id: 2, color: "fff"}