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 Ember Data with Local Storage

DS is not defined

I've followed the whole video and did everything that was done in the video. Nevertheless, if I preview the project I get a blanc screen and the error: Uncaught ReferenceError: DS is not defined. routes/posts.js:

Blogger.PostsRoute = Ember.Route.extend({
  model: function(){
    return this.store.find('post');
  }
});

models/post.js:

Blogger.Post = DS.Model.extend({
  title: DS.attr(),
  body: DS.attr()
});

models/comments.js:

Blogger.Comment = DS.Model.extend({
  text: DS.attr()
});

index.html:

<!DOCTYPE html>
<html>

<head>
  <title>Dracula's blog</title>

  <link rel="stylesheet" href="css/bootstrap.css">

  <script src="libs/jquery-1.11.1.js"></script>
  <script src="libs/handlebars-v1.3.0.js"></script>
  <script src="libs/ember.js"></script>
  <script src="libs/ember-handlebars-loader-0.0.1.js"></script>
  <script src="libs/ember-data.js"></script>
  <script src="libs/localstorage_adapter.js"></script>

  <script src="blogger.js"></script>
  <script src="router.js"></script>
  <script src="store.js"></script>

  <script src="controllers/about.js"></script>
  <script src="controllers/contact.js"></script>
  <script src="controllers/post.js"></script>
  <script src="controllers/posts.js"></script>

  <script src="routes/posts.js"></script>
  <script src="routes/post.js"></script>
  <script src="routes/recent-comments.js"></script>

  <script src="models/post.js"></script>
  <script src="models/comment.js"></script>

  <script>
    EmberHandlebarsLoader.loadTemplates(['posts', 'about', 'contact', 'phone', 'email', 'application', 'recent-comments', 'post']);
  </script>
</head>

<body>

</body>
</html>

Am I overlooking something?

4 Answers

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Hello Sanne van Tongelen

The first error I see is about the ember-data.js file. I opened your ember-data.js file and it was missing some of the code. I replaced the code in your workspace and it seems to be working now. I'm not sure how the code disappeared from the ember-data.js file, but that was the issue.

Thanks very much. :)

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Sanne van Tongelen are you working in Workspaces for this? If so can you take a Workspace snapshot and share it here in the forum?

Talha Khalid
Talha Khalid
10,262 Points

Could you also provide me with the solution to this? I appear to be having the same problem as well. Here is a snapshot of my workspace:

https://w.trhou.se/wwm5fnwsze

Thanks!

Here is a link to the screenshot of my dev tools, this is where the error appears. Screenshot devtools

The workspace snapshot doesn't add any value, so I added a screenshot, with my index file and the folders opened. Screenshot workspaces

Hopefully this gives you enough information.

Dave McFarland
Dave McFarland
Treehouse Teacher

Hi Sanne van Tongelen. A Workspace snapshot would be the best way for us to track down the error -- we can fork your snapshot into a workspace, then test your code to see what is going wrong. The screenshots aren't that helpful in tracking down this error. Could you post a snapshot? Thanks

Here is a Snapshot of my workspace