Skip to content

Instantly share code, notes, and snippets.

@hilem
Created January 14, 2013 03:05
Show Gist options
  • Save hilem/4527494 to your computer and use it in GitHub Desktop.
Save hilem/4527494 to your computer and use it in GitHub Desktop.
Is this really necessary?
App = Ember.Application.create()
App.Adapter = DS.RESTAdapter.extend()
App.store = DS.Store.create({
revision: 11,
adapter: App.Adapter.create()
})
App.MyModel = DS.Model.extend({
name: DS.attr('string')
})
// The following works using the latest Ember/Ember-Data as of 1/13/2013
// But I feel like there is a better way to do this.
var tmp = App.MyModel.createRecord({ name: "TEST" })
App.store.adapter.createRecord(App.store, App.MyModel, tmp)
@raila
Copy link

raila commented Jan 14, 2013

With the latest ember.js you don't need to provide the adapter anymore. It is set to RESTAdapter by default.

App.MyModel.createRecord({ name: "TEST" })
App.store.commit()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment