Skip to content

Instantly share code, notes, and snippets.

@wycats
Created October 17, 2012 17:29
Show Gist options
  • Save wycats/3906890 to your computer and use it in GitHub Desktop.
Save wycats/3906890 to your computer and use it in GitHub Desktop.
App.Router.map(function(match) {
match("/posts/:post_id").to("post");
});
App.PostRoute = Ember.Route.extend({
// default implementation
deserialize: function(router, params) {
return App.Post.find(params.post_id);
},
serialize: function(router, post) {
return { post_id: post.get('id') };
},
setupControllers: function(router, post) {
router.set('postController.content', post);
}
renderTemplate: function() {
this.render('post', { into: 'application', controller: 'post' });
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment