Skip to content

Instantly share code, notes, and snippets.

@shenst1
Created June 4, 2015 00:33
Show Gist options
  • Save shenst1/198250dd5012feec8cb5 to your computer and use it in GitHub Desktop.
Save shenst1/198250dd5012feec8cb5 to your computer and use it in GitHub Desktop.
create
xport default Ember.Controller.extend({
needs: ['organization'],
actions: {
create: function() {
var title = this.get('title');
var organization = this.get('controllers.organization');
var dataset = this.store.createRecord('dataset', {
title: title
});
this.set('title', '');
dataset.save();
organization.get('model.datasets').addObject(dataset);
this.transitionToRoute('dataset', dataset);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment