Facing a weird problen in ruby. Please refer following snippet.
@items_list = []
params[:items].each do |item|
status, item_data, _status_code = get_item_details(item[:item_code])
@items_list << item_data if status # item_data is a ruby hash
end
@items_list
But, at the end Array(@items_list)
has last inserted value the times data is inserted. This is unexpected behaviour for an array.