bloggr-client
bloggr-client copied to clipboard
Refresh on index.html#/posts/1 does not work
Seems like you haven't created the PostController, happened to me as well.
This looks for the post id in the url and loads the respective post
App.PostRoute = Ember.Route.extend({
model: function(params) {
return posts.findBy('id', params.post_id);
}
});
@skippednote I ran into the same issue and indeed hadn't created my ThingController. However, It still didn't work. After a little debugging I noticed Ember returns the ID as a string. Therefore, if (which was my case), your ID's are set as integers in your JSON, you'll need to tweak the code as follows :
App.PostRoute = Ember.Route.extend({
model: function(params) {
return posts.findBy('id', parseInt(params.post_id));
}
});
I also ran into the same problem as you guys. What I did to fix it was add the code
App.PostRoute = Ember.Route.extend({ model: function(params) { return posts.findBy('id', params.post_id); } });
I also needed to remove the {{format-date}} out of the index.html in the 'post' template and just leave 'date'. This is around the 13:40 mark of the video. I am not sure yet how it will affect it moving forward but to this point this seems to work.