I am using Ruby 1.9.2 and Rails 3.0.1 and I am getting a weird issues with YAML. Here is my YAML file:
#config/tags_constants.yml
:main_ingredients: &ingredients
- Beans
- Beef
- Cheese
- Chocolate
- Dairy
- Eggs
- Fish
- Fruits
- Game
- Lamb
- Nuts
- Pasta
- Pork
- Poultry
- Rice/Grains
- Shellfish
- Tofu/Soy
- Vegetables
:excluded_ingredients:
<<: *ingredients
Here is what I am seeing in the console:
> hash = YAML.load(File.open("config/tags_constants.yml"))
> hash["excluded_ingredients"]
=> {开发者_如何学Go#<Syck::MergeKey:0x00000101b379d0>=>["Beans", "Beef", "Cheese", "Chocolate", "Dairy", "Eggs", "Fish", "Fruits", "Game", "Lamb", "Nuts", "Pasta", "Pork", "Poultry", "Rice/Grains", "Shellfish", "Tofu/Soy"]}
How do I get YAML to merge the values without adding these weird Syck::MergeKey objects?
Try the following:
client: &client
- Brad
- Angelina
:development:
:requests: 1
:client:
:session: "something"
:paths:
*client
精彩评论