我正在为我的 table 写一个固定装置。其中一个列接受 JSON 字符串作为值。
问题是夹具没有加载失败:
Fixture::FormatError: a YAML error occurred parsing /home/saurajeet/code/dcbox/test/fixtures/hardware.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html
The exact error was:
ArgumentError: syntax error on line 145, col 73: ` portslist: [{"name":"ob1","port_num":0,"port_type":"network"},{"name":"ob2","port_nu'.....
对此的任何解决方案。
最佳答案
我相信把它放在引号里应该可以解决问题:
portslist: '[{"name":"ob1","port_type" ... }]'
关于ruby-on-rails - 将 JSON 数据嵌入 YAML 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9532840/