Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Ember.js Ember Data Relationships in Ember Data

Artem Syromiatnikov
Artem Syromiatnikov
4,706 Points

LSSerializer throws an error

I was following the instructions exactly, re-watched the video twice and compared everything i could. Still, I get an exception:

localstorage_adapter.js:11 Uncaught TypeError: Cannot read property 'determineRelationshipType' of undefined
localstorage_adapter.js:11 DS.LSSerializer.DS.JSONSerializer.extend.serializeHasMany

I'm using Ember 1.7.0 and Ember Data : 1.0.0-beta.11.

Here are my models:

Blogger.Post = DS.Model.extend({
  title: DS.attr(),
  body: DS.attr(),
  comments: DS.hasMany('comment', {async: true})
});
Blogger.Comment = DS.Model.extend({
  text: DS.attr(),
  post: DS.belongsTo('post', {async: true})
});

Any help is highly appreciated.

4 Answers

We solved this specific problem, but it's worth pointing out that the method of "search for the exact error message on google" method of debugging is too frequently overlooked and highly useful.

I have not played around this with this but searching for the exact error message ("Cannot read property 'determineRelationshipType' of undefined") turned up this stackover flow post which seems to suggest to use ember-data 1.0.0-beta.11 and ember-localstorage-adapter 0.5.0

So your models are in separate files?

Might be worth changing to the version of Ember Data being used in the videos: Ember Data : 1.0.0-beta.9, just to be on the safe side...

Artem Syromiatnikov
Artem Syromiatnikov
4,706 Points

Yep, my models are in separate files. I've changed Ember data version to beta 9, but the errors remains so far.

jason chan
jason chan
31,009 Points

kind of weird that it doesn't work on chrome, but it works on firefox? Then again it also might be cache error. Clear cache. Everytime you try something new.

So, you are trying the same thing as the original poster and getting different results in firefox vs chrome?