1

当您在 Rails 应用程序中遇到错误时,使用默认错误处理您将获得类似于以下内容的输出:

http://i.imm.io/UDtV.png

请求参数部分 JSON 的打印方式非常难以阅读 - 除非您仔细阅读每一行,否则无法看到层次结构。有没有办法使用适当的缩进以更易读的方式显示它?举个例子:

{
    "utf8"=>"✓",
    "_method"=>"put",
    "authenticity_token"=>"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "task"=>{
        "title"=>"Task1",
        "instructions"=>"Do the task",
        "weighting"=>"10",
        "detail_attributes"=>{
            "is_yes_no"=>"false",
            "id"=>"1"
        },
    },
    ...
}
4

0 回答 0