为什么(在铁路中评估)
[{:a => :b}].collect {|x| OpenStruct.new(x)}.to_json
添加“表”记录。
"[{"table":{"a":"b"}}]
我只想这样做:
"[{"a":"b"}]
Does it mean that Rails to_json method handles OpenStruct in a different way? When I try it in the irb, it s not there:
require ostruct
[{:a => :b}].collect {|x| OpenStruct.new(x)}.inspect