I am new to ruby. I have a loop where i want to create a array:
@line_items.each do |i|
if @line_items[0].product.user.email == i.product.user.email
@foodio = i.product.user.email
else
@foodio[i] = i.product.user.email
end
end
In above code, i am checking, whether line_items a different users.
In first part, if all line_items have same users, email will be @foodio. But if users are different, @foodio[] will store emails of all users.
How to do this? Please help!