mardi 6 octobre 2015

Ember: Underscore model name in JSON while saving model

I have a problem with my Ember + Rails app.

I have a model called GuestGroup. I use ActiveModelAdapter to connect to my Rails back-end. When I save the model to my backend, Ember sends the following json:

{guestGroup: {title: "test", wedding: "1"}}

As you can see, the model name is in camelCase. But I expect it to be snake_case:

{guest_group: {title: "test", wedding: "1"}}

I have 2 questions:

  1. Why ActiveModelAdapter doesn't convert model name to snake_case? It reads underscored JSON from server without problems.
  2. How can I send my model name underscored?

Aucun commentaire:

Enregistrer un commentaire