Skip to content

Instantly share code, notes, and snippets.

@koemeet
Last active March 23, 2016 02:35
Show Gist options
  • Save koemeet/8daaa5b674fe7902241a to your computer and use it in GitHub Desktop.
Save koemeet/8daaa5b674fe7902241a to your computer and use it in GitHub Desktop.
// routes/company/clients.js
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
let company = this.modelFor('company');
// this
return this.get('store').query('client', {
company: company.get('id')
});
// or simply do this
return company.get('clients');
}
});
// routes/company.js
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
return this.get('store').findRecord('company', params.company_id);
}
});
this.route('company', { path: '/company/:company_id' }, () => {
this.route('clients');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment