I have an ember.js application:
In the person model there is a name field. Further, customer has a foreign key on person.name, and executor has many-to-many to person.name via member. When I do a query query for a customer, I load the person’s model data (the back-end gives no more than 10 entries) and as a result, for the executor, the data that was originally from member.person is gone. How to display person.name for both customer and executor?
model.js
export default DS.Model.extend({ customer: DS.belongsTo('person'), executors: DS.hasMany('member'), }); template.hbs
<form> <p> Customer: {{input type="text" value=personValue key-up=(action 'handleFilterCustomer') placeholder="customers"}} <ul> {{#each model.customers as |customer|}} <li>{{customer.name}}</li> {{/each}} </ul> </p> <p> Member: <select> {{#each model.members as |member|}} <option value={{member.id}}>{{member.id}} {{member.person.name}}</option> {{/each}} </select> </p> </form> route.js
model() { let currentProject = this.get('session.data.project.id'); return RSVP.hash({ customers: this.store.peekAll('person'), members: this.store.query('member', {project: currentProject}), }); }, controller.js
personValue: '', actions: { handleFilterCustomer(){ let filterInputValue = this.get('personValue'); this.store.unloadAll('person'); this.get('store').query('person', { name: filterInputValue }); }, }