I have
App.Employee.FIXTURES = [{
id: 1,
firstName: 'Charlie'
lastName: 'Hayes'
}, {
id: 2,
firstName: 'Ray'
lastname: 'White'
}];
I implemented the queryFixtures for the FixtureAdapter
I execute this statement in a controller to find the matching records
var model = this.store.find('employee', {lastName: 'Hayes'})
transitionToRoute('employee', model)
In the EmployeeRoute’s serialize method, the model object is not what I expected it to be.
model contents(just the data tree from root):
- content: Array[1]
- 0: Object
- record: Class
- _data: Object
firstName: "Charlie"
lastName: "Hayes"
I was expecting it to match
var model = this.store.find('employee', 1)
model contents:
- _data: Object
firstname: "Charlie"
lastName: "Hayes"
Because of this difference, the model.get(‘lastName’) in EmployeeRoute’s serializer implementation returns undefined and the employee template does not display any values. Although, the query is an asynchronous call, why does it not resolve to an object with the template matching the latter.
Is the implementation of queryFixtures() wrong? How do I get the model in controller with the {lastName: ‘Hayes’} query?