I have an array of rooms: rooms_array = [room1...roomn] and each room is a hash with respective details. Each room hash has an offers hash.
room1 = {...., offers=> {...},...}
Now I have another array of offers hashes.
avg_array = [[{offer1},{offer2}],[{offer4},{offer3}],....]
Length of both the hashes is same, so first array of avg_array is for room1, second for room2 and so on...
My problem is how do I add each array of avg_array into corresponding offers hash of rooms_array.
My attempt:
_rooms.values.map do |room|
if room[:offers].count > 1
i=0
room[:offers] = rooms_hash[i]
i = i + 1
end
end
{offer1}is not a valid Ruby object.