Ember-data and MongoDB, how to handle _id

后端 未结 9 808
别跟我提以往
别跟我提以往 2021-02-08 17:20

I\'m using ember-data with rails and MongoDB and am having problem with the way IDs are stored in MongoDB - in a _id field.

Ember-data will use id as the default field f

9条回答
  •  逝去的感伤
    2021-02-08 17:58

    An other way could be to use (if possible for you) the ActiveModel::Serializer. (I think it should be close to rabl (?))

    From the ember-data gihtub: https://github.com/emberjs/data:
    Out of the box support for Rails apps that follow the active_model_serializers gem's conventions

    When we began with ember-data we were crafting as_json(), but using the gem is definitely better :)

提交回复
热议问题