Sha256: bdb43b79567e27a1a21e2b745d2448ab3a86e046ebffa5cb86ec30102fe95150

Contents?: true

Size: 608 Bytes

Versions: 6

Compression:

Stored size: 608 Bytes

Contents

export default Ember.Route.extend({
  model: function() {
    return this.store.createRecord('<%= file_name.singularize -%>');
  },
  deactivate: function() {
    var model = this.get('controller.model');
    if (model.get('isNew')) {
      model.deleteRecord();
    }
  },
  actions: {
    save: function() {
      var model = this.get('controller.model');
      var _this = this;
      model.save().then(function() {
        _this.transitionTo('<%= file_name.pluralize -%>.show', model);
      });
    },
    cancel: function() {
      this.transitionTo('<%= file_name.pluralize -%>.index');
    }
  }
});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ember-appkit-rails-0.3.2 lib/generators/templates/scaffold/route/new.js.es6
ember-appkit-rails-0.3.1 lib/generators/templates/scaffold/route/new.js.es6
ember-appkit-rails-0.3.0 lib/generators/templates/scaffold/route/new.js.es6
ember-appkit-rails-0.2.2 lib/generators/templates/scaffold/route/new.js.es6
ember-appkit-rails-0.2.1 lib/generators/templates/scaffold/route/new.js.es6
ember-appkit-rails-0.2.0 lib/generators/templates/scaffold/route/new.js.es6