kurko / ember-json-api

JSON API adapter for Ember Data.
MIT License
254 stars 62 forks source link

Camelize relationship key to make hasMany href relations work #61

Closed ahx closed 9 years ago

ahx commented 9 years ago

When there is a relationship with a camelized name like Post.hasMany('someResource'), but the "links" object has a called 'some_resources' ED could not find the relationship (see test). This PR camelizes the link key to make that work.

I was thinking about if this should belong somewhere else like inside ED's normalizeRelationships function, but doing it inside ember-json-api was easy and since ember-json-api already uses the convention "camel case inside the model, underscores in the JSON payload", doing this inside ember-json-api looks legit.