Rails5:固定装置包含 json

Rails5: fixtures containing json

我需要为具有以下字段的模型请求创建夹具: body -> JSON created_at - 日期时间 updated_at - 日期时间 remote_ip - 即 127.0.0.01 状态 - 即 1

我试过:

request1:
  body: {"title": "test", "Action": "test_action"}
  created_at: 2018-06-13 21:15:51
  updated_at: 2018-06-13 21:15:51
  remote_ip: 127.0.0.1
  status: 1

但结果我没有在 db 的 body 列中得到 o JSON 但

---
title: test
Action: test action

我应该怎么做才能在 body 字段中获得完整的 JSON?

我找到的最简单的解决方案是将 json 视为字符串:

body: '{"title": "test", "Action": "test_action"}'

它有效,但我不确定它是否是最佳解决方案....