Embedding JSON Data into YAML file

后端 未结 5 1992
孤城傲影
孤城傲影 2020-12-13 16:52

I am writing a fixture for my table. And a one of the coloums takes in a JSON string as a value.

The problem is the fixture is not loading failing as:



        
5条回答
  •  [愿得一人]
    2020-12-13 17:44

    For the sake of being complete: In case you're using ActiveRecord::Store, you can load your data simply using YAML representation of the same data, even if it is a JSON store:

    one:
      portslist:
        - 
          name: 'ob1'
          port_num: 0
          port_type: 'network'
        - 
          name: 'ob2'
          port_num: 1
          port_type: 'network'
    

提交回复
热议问题