Skip to content

Using Ember Data 2.0.0-beta1 with ActiveModel::Serializer::Adapter::JsonApi #1080

@mattboldt

Description

@mattboldt

Since the new ember no longer has DS.ActiveModelSerializer or DS.ActiveModelAdapter, I'm looking to switch to their new DS.JSONAPISerializer. This seems to be the best way to go, if the previous two won't be supported in the future.

Ember is expecting the data from the api to be something like

store.push({
  data: {
    id: '1', 
    type: 'user', 
    attributes: { 
      name: 'Pangratz' 
    }
  }
});

But from my rails app, with the :json_api option set to true, my api is returning user as users plural.

  data: {
    id: '1', 
    type: 'users', 
    attributes: { 
      name: 'Pangratz' 
    }
  }

Ember expects a singular model name, and as such cannot push data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions