Created
October 16, 2013 10:39
-
-
Save ugisozols/7005862 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.Entry = DS.Model.extend({ | |
title: DS.attr("string"), | |
content: DS.attr("string") | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.NewController = Ember.ArrayController.extend({ | |
actions: { | |
createEntry: function() { | |
var title = this.get("newTitle"), | |
content = this.get("newContent"); | |
var entry = this.store.createRecord('entry', { | |
title: title, | |
content: content | |
}); | |
entry.save(); | |
this.set("newTitle", ""); | |
this.set("newContent", ""); | |
this.transitionToRoute("entries"); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment