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 trialAndrew Alvarez
11,964 PointsChallenge Task 1 of 1
Challenge Task 1 of 1
Update these two models so that a person has many puppies, and a puppy belongs to a person. Bummer! There was an error with your code: SyntaxError: Parse error
what am i doing wrong?
AnimalShelter = Ember.Application.create();
AnimalShelter.Person = DS.Model.extend({
name: DS.attr(),
puppies: DS.hasMany('puppy', {async: true});
})
AnimalShelter.Puppy = DS.Model.extend({
name: DS.attr(),
person: DS.belongsTo('person', {async: true});
});
<!DOCTYPE html>
<html>
<head>
<title>Animal Shelter</title>
</head>
<body>
<script src="js/libs/jquery-1.10.2.js"></script>
<script src="js/libs/handlebars-v1.3.0.js"></script>
<script src="js/libs/ember-1.8.1.js"></script>
<script src="js/libs/ember-data-1.0.0b9.js"></script>
<script src="js/app.js"></script>
<script type="text/x-handlebars" id="puppies">
<h1>Puppies</h1>
</script>
</body>
</html>
3 Answers
Grace Kelly
33,990 PointsHi Andrew, it looks like the issue is you have semi-colans at the end of the lines containing puppies: and person: , if you remove them the code should work :) for example:
puppies: DS.hasMany('puppy', {async: true}) //removed semi-colan
Hope that helps!!
Michelle Giralico
8,328 PointsI am also having the same issue. I've checked other forum posts and I'm still getting the same error in the challenge " Bummer! There was an error with your code: SyntaxError: Parse error". Is it possible that there is a bug?
Here is the code I used for the challenge:
AnimalShelter = Ember.Application.create();
AnimalShelter.Person = DS.Model.extend({
name: DS.attr()
puppies: DS.hasMany('puppy', {async: true})
});
AnimalShelter.Puppy = DS.Model.extend({
name: DS.attr()
person: DS.belongsTo('person', {async: true})
});
Michelle Giralico
8,328 PointsI figured it out. I was missing the comma after DS.attr( ) in both lines. It's always the little things.