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

Comments not working for ember.js

https://teamtreehouse.com/workspaces/9205022

Help my comments are not working for blog post. I don't know why

Blogger.NewCommentController = Ember.Controller.extend({
    needs: ['post'],
    actions: {
        save: function(){
            var comment = this.store.createRecord('comment', {
                text: this.get('text')
            });
            comment.save();

            var post = this.get('controllers.post.model');
            post.get('comments').pushObject(comment);
            post.save();

            this.transitionToRoute('post', post.id);
        }
    }
});

Help I don't know.....

3 Answers

solution in the post.js file i forgot the s in the property of comment to comments :

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

SOLVED

I had that same problem. Ember conventions can get confusing sometimes.

I'm going to try to build this site again with the latest builds. So it's going to be different from what teamtreehouse has. But i have to learn rails first to get the backend working. Ember is frontend no database. Maybe someone should do tutorial with firebase.

im kind of trying to do the same thing but using laravel as the backend. If you are interested in learning how to use laravel and ember i found this website that has a lot of articles on them http://culttt.com/2015/04/06/getting-started-with-laravel-and-ember/

Thanks man. I plan to do that in the near future. Going to learn laravel from laracast. Gonna use laravel 5.