假设你想
records = Model.all
records.to_a.map{|m| m.serializable_hash(:root => true)}
就像to_json(:root => true)
_
[
{
"model": {
"attribute_1": "value_1",
"attribute_2": "value_2",
}
}
...
]
假设你想
records = Model.all
records.to_a.map{|m| m.serializable_hash(:root => true)}
就像to_json(:root => true)
_
[
{
"model": {
"attribute_1": "value_1",
"attribute_2": "value_2",
}
}
...
]