iterate through a multi dimensional hash

The problem I'm having is that I need to extract the value of amazon and chef separately. Right now they are both held in the b value in my iteration. I tried to create another loop within the value.each but i'm getting an error. How do I efficiently extract both value separately and efficiently?

any help would be greatly appreciated.

I'm getting my hash from a yaml file this way

require 'yaml' path = File.join(Rails.root, 'config', 'stage-aws-opscode.yml') SAO = YAML.load_file(path) The stage-aws-opscode.yml contains the following data

sandbox: &defaults   amazon: aws-green   chef: mdsol

validation:   <<: *defaults

cruise:   <<: *defaults

hendricks:   <<: *defaults

distro:   <<: *defaults

performance:   <<: *defaults

innovate:   amazon: aws-red   chef: mdsol-production

production:   amazon: aws-red   chef: mdsol-production

this is my iteration.

<% SAO.each do |key, value| parent = "#{key}"   value.each do |a, b|    "#{a}" "#{b}"   end end     %>