Skip to content

Instantly share code, notes, and snippets.

@mockra
Created October 28, 2014 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mockra/61b706e673a6197eb817 to your computer and use it in GitHub Desktop.
Save mockra/61b706e673a6197eb817 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.ObjectController.extend({
actions: {
create: function(post) {
var self = this;
var comment = this.store.createRecord('comment', {
post: post,
content: this.get('content')
});
comment.save().then(function(comment) {
self.transitionToRoute('comments.show', comment);
}).catch( function(reason) {
console.log(reason);
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment