ember-parse-adapter
ember-parse-adapter copied to clipboard
additional user attributes
I'm having fun trying your adapter but I was wondering if it's possible to add more attributes to User Model.
App.User = DS.ParseUserModel.extend({
posts: DS.hasMany('post')
});
Something like this doesn't work. Is there another way to do it?
Also is there a way to access the model through store?
var user = this.store.find('user');
user.get('username')
returns undefined even though username is in DS.ParseUserModel.
I'm still a student so I'm not sure if these are dumb questions but if you could help me with them that would be great! thanks
Sorry turns out they were stupid questions because I got it working!
I am however having an issue with associations on a user object after logging that user in. Assume this:
App.User = DS.ParseUserModel.extend({
posts: DS.hasMany("post")
});
App.User.login(@get("email"), @get("password"))
then if I try to access the "posts" property I get this error:
Error: Assertion Failed: You looked up the 'posts' relationship on '<(subclass of DS.ParseUserModel):ember643:qMpHlel4II>' but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (`DS.hasMany({ async: true })`)
However, this error can be avoided if the user is loaded first:
this.get("store").find("user", userId)
Can anyone confirm?
@conrad-vanl do you still get the bad behavior? What if you make the relationship {async: true}
?
regarding adding additional attributes, related to #50