For Active记录其工作正常
ActiveRecord :: Base.include_root_in_json = false
User.first.as_json
=> { "id" => 1, "name" => "Konata Izumi", "age" => 16,
"created_at" => "2006/08/01", "awesome" => true}
当我将它用于Neo4j.rb主动节点
时Person.first.as_json
=> {"person"=> {" first_name"=>"Kay", "last_name" => "Wood",
"email" => "wood.kay@kozey.co" } }
这我将如何通过API发送repsosne,我不需要这个根元素任何帮助?
答案 0 :(得分:2)
来自neo4j文档:
include_root_in_json
序列化ActiveNode和ActiveRel时 对象,如果模型名称的JSON中有根。
默认值:true
所以你可以添加
config.neo4j.include_root_in_json = false
config/application.rb
中的。