I wish there were an ember-data adapter that would use the url instead of using query strings for looking up related models
For example pull from url/model/model_id/releatedModel/
instead of pulling from url/relatedModel?ids="3,4,5"
You have a company with different departments filled with employees serving different roles in the company. So you would have models like this in Ember:
Department Model
App.Department = DS.Model.extend({
name: DS.attr('string'),
employees: DS.hasMany('employee')
})
Employee Model
App.Employee = DS.Model.extend({
department: DS.belongsTo('department'),
name: DS.attr('string'),
roles: DS.hasMany('role')
})
Role Model
App.Role = DS.Model.extend({
name: DS.attr('string')
})
You could use
url/department/2/employees/
url/employee/43/roles/
instead of
url/employees?ids=...
url/roles?ids=...
I think an added benefit would be that in the JSON, you would not need to require the ids of the related Models (they could just be option)
I have no experience writing adapters but, would this be difficult to achieve?
Heres an update:
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>