Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh on index.html#/posts/1 does not work #3

Open
russellbits opened this issue Aug 16, 2013 · 3 comments
Open

Refresh on index.html#/posts/1 does not work #3

russellbits opened this issue Aug 16, 2013 · 3 comments

Comments

@russellbits
Copy link

russellbits commented Aug 16, 2013

No description provided.

@skippednote
Copy link

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);
    }
});

@benjaminhorner
Copy link

@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));
    }
});

@Klanders85
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants