I am facing an issue with accessing properties to change the header of my RESTAdapter after loading the user.
Do you have any ideas why that might be happening?
The code snippet in question is as follows:
var user = '';
App.MainRoute = Ember.Route.extend({
model: function(params){
user = this.store.find('user',{email: params.email});
alert(user.hash); //getting undefined
return user;
},
actions:{
addList: function(){
var list = this.store.createRecord('list', {
name: 'New list',
desc: 'Describe it here'
});
this.store.find('user', 1).then(function(user){
list.set('user', user);
})
list.save();
}
}
})
The JSON response on
this.store.find('user', {email: params.email});
:
{
"users": [
{
"id": 1,
"hash": "66ff7d6eae591ca2a7d6b419991690e8",
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2d404c5f5b44433d20464f414c4e464144")">[email protected]</a>",
"name": "",
"lists": []
}
]
}
For more details on model definitions, please refer to this link.