Ruby on rails 活动模型序列化程序rails json在另一个json对象中不起作用

Ruby on rails 活动模型序列化程序rails json在另一个json对象中不起作用,ruby-on-rails,json,ruby,active-model-serializers,Ruby On Rails,Json,Ruby,Active Model Serializers,我在rails中使用活动模型序列化程序,这是我的代码片段 # GET /users def index @users = User.all render json: {data: @users, status: httpstatus[:getSuccess]} # render json: {data: @users, status: httpstatus[:getSuccess]} end 但《邮递员》就是这样的 "data": [ { "id": 38,

我在rails中使用活动模型序列化程序,这是我的代码片段

# GET /users
  def index
    @users = User.all
    render json: {data: @users, status: httpstatus[:getSuccess]}
    # render json: {data: @users, status: httpstatus[:getSuccess]}
  end
但《邮递员》就是这样的

"data": [
{
  "id": 38,
  "name": "tyasa",
  "age": 21,
  "created_at": "2017-05-30T06:23:03.504Z",
  "updated_at": "2017-05-30T06:23:03.504Z"
},
{
  "id": 39,
  "name": "wahyu",
  "age": 21,
  "created_at": "2017-05-30T06:23:37.359Z",
  "updated_at": "2017-05-30T06:23:37.359Z"
},]
但是,当只渲染@users时,它就起作用了

# GET /users
  def index
    @users = User.all
    render json: {data: @users, status: httpstatus[:getSuccess]}
    # render json: @users
  end
我只想从json中删除创建的和更新的。 如何解决这个问题。。 糟糕的英语

我只想从json中删除创建的和更新的

您可以使用的
选项除外

应该给你什么

"data": [
{
  "id": 38,
  "name": "tyasa",
  "age": 21
},
{
  "id": 39,
  "name": "wahyu",
  "age": 21
},]
请跟随
"data": [
{
  "id": 38,
  "name": "tyasa",
  "age": 21
},
{
  "id": 39,
  "name": "wahyu",
  "age": 21
},]