rails iterate activerecord hash key value code example
Example: iterate over each key value in hash ruby
restaurant_menu = { "Ramen" => 3, "Dal Makhani" => 4, "Coffee" => 2 }
restaurant_menu.each do | item, price |
puts "#{item}: $#{price}"
end
restaurant_menu = { "Ramen" => 3, "Dal Makhani" => 4, "Coffee" => 2 }
restaurant_menu.each do | item, price |
puts "#{item}: $#{price}"
end