Hash inside YAML file?

后端 未结 3 1816
失恋的感觉
失恋的感觉 2020-12-30 21:41

I want to include a hash and list inside a YAML file that I\'m parsing with the following command:

APP_CONFIG = YAML.load_file(\"#{RAILS_ROOT}/config/config.         


        
3条回答
  •  灰色年华
    2020-12-30 22:19

    Old question, but since I was in a similar spot... Like Jasper pointed out, Ceilingfish's answer is correct. But you can also do

    feeds:
     - url: 'http://www.google.com'
       label: 'default'
    

    to avoid having to rely on trailing whitespace after the dash.

提交回复
热议问题