Questions tagged [ember-data]

ember-data is a data persistence extension for the Ember.js framework.

Because the MVC framework builds applications which run in the browser rather than returning fully-rendered pages in response to browser requests, it requires a method for saving and reloading user data.

Ember.js supports a number of "data persistence" libraries, including a data store component inherited from the framework. In general these frameworks support CRUD operations on a RESTful web service, and as such they are agnostic regarding the technology of the back-end web service.

Ember-data is the "official" data persistence library for Ember.js, supported by the Ember.js team. It uses "adapters" to load data for use by Ember.js applications, and allows developers to write custom adapters to support their own specific data store.

Beta Period

During the beta period (up until 1.0) the API is constantly changing, you can keep up to date by reading the Transition Document.

Getting help

Ember-data is supported in much the same way as Ember.js itself.

The Stack Overflow tag is actively monitored by several contributors to Ember. You may try asking questions in the active IRC channel #emberjs on irc.freenode.net. Other resources can found on the Ember.js community page

Technical questions that are accompanied by working code make it easier for other to help give good answers. JSFiddle | JSBin

To report bugs against Ember.js, or to propose new functionality, create an issue on the Github project.

5483 questions
2
votes
0 answers

How should 'conventional' Ember-friendly APIs be designed for creation of mutually dependent parent and child models?

I'm building a Rails app with an Ember front-end. I'm trying hard to ensure that the API is as plain, vanilla, RESTful and conventional as possible, in the Rails/Ember spirit. I'm confused as to how to handle a situation where a parent model…
doublea
  • 2,546
  • 1
  • 23
  • 35
2
votes
1 answer

Correct usage of store.loadMany() function

I'm trying to figure out how to populate a table from a JSON object. My JSON is a structurated object: { id: 0, list: [{ username:'user_1',online:true, user:0 }, { username:'user_2',online:true, user:0 }] } My Model is defined as…
sircamp
  • 107
  • 2
  • 10
2
votes
3 answers

Get RESTAdapter host

RESTAdapter has the possibility to specify a url for the backend: DS.RESTAdapter.reopen({ url: 'https://api.example.com' }); How can I access this property programmatically? I mean something like: DS.RESTAdapter.get('url') <-This doesn't work
joscas
  • 7,474
  • 5
  • 39
  • 59
2
votes
1 answer

How to iterate through a hasMany collection in Ember using a different controller for each record

I have three models defined in Ember and all returning json on request: App.Comment = DS.Model.extend({ discussion: DS.belongsTo('App.Discussion') }); App.Discussion = DS.Model.extend({ meeting: DS.belongsTo('App.Meeting'), comments:…
i0n
  • 916
  • 1
  • 8
  • 26
2
votes
1 answer

belongsTo only being set on first and last member of hasMany

My adapter uses findHasMany to load child records for a hasMany relationship. My findHasMany adapter method is directly based on the test case for findHasMany. It retrieves the contents of the hasMany on demand, and eventually does the following…
S'pht'Kr
  • 2,809
  • 1
  • 24
  • 43
2
votes
2 answers

Ember Data sideloaded properties being dropped on a model

I'm working with Ember RC3 Ember Data Revision 12 Handlebars RC3 I have Ember Data sideloading relationships on many of my models, so that I can template the sideloaded relationships like so: // Models App.Client = DS.Model.extend({ company:…
ianstarz
  • 417
  • 4
  • 12
2
votes
1 answer

How do params work in Ember, especially when you have nested resources?

I am using ember with rails, and I have not had success trying to pass the parent_id param to get items from a database using the parent_id. The only way i have been able to retrieve has_many items of a belongs_to resource has been to have the…
Kyrie
  • 39
  • 3
2
votes
1 answer

Attempt to call loadedData when saving models in ember

I keep getting this error in my app but have no idea what is causing it. It happens whenever I commit my data store: Attempted to handle event loadedData on while in state rootState.loaded.updated.inFlight. Called with undefined Anyone? Here is…
l33z3r
  • 617
  • 5
  • 16
2
votes
1 answer

What's the right way to delete a record in Ember Data revision 12?

I'm using revision 12 of Ember Data. I've got a simple method on an ArrayController that tries to delete a single record, and is called from an action in a template: deleteFact: function(fact) { self=this; window.App.confirm(Em.I18n.t('Delete…
jmcd
  • 4,269
  • 5
  • 36
  • 36
2
votes
3 answers

How to detect if a new record in ember data has changed

I want to detect a change in a new record. However, the record is new and dirty from the moment I create it. var record = transaction.createRecord(App.ContentOfSomeSort, data); record.get('isNew'); // true record.get('isDirty'); // true Is…
Evil Buck
  • 1,068
  • 7
  • 20
2
votes
1 answer

Ember Data: Observing associated models

I've been working on implementing tagging with rails and ember, based on this railscast: http://railscasts.com/episodes/382-tagging I've setup an ember-data model with a tagList property, which I'd like to set every time a tag changes (using the…
Dom Christie
  • 4,152
  • 3
  • 23
  • 31
2
votes
0 answers

Deleting records with Basic Adapter

I'm looking at implementing Model.sync.deleteRecord() for use with Ember-Data Basic Adaptor. According to the docs, adapter must call didDeleteRecord() once record has been successfully deleted from the server. However, I can't find good example on…
anton
  • 31
  • 2
2
votes
0 answers

Testing ember form submission with konacha

We're trying to test behavior of a form in our system using konacha and sinon. In the routes, form submission is handled with the following pattern: save: (object) -> object.one "didCreate", @, -> @transitionTo "nextStep" object.one…
Matt
  • 71
  • 5
2
votes
1 answer

How to handle cancel/rollback when transitioning between views in emberjs

So I asked a similar question awhile back. However, something about that solution left a bad smell. Here's the scenario, when I want to create a record I have a new route. So for example PostsNewRoute that looks something like: App.PostsNewRoute =…
spullen
  • 3,227
  • 18
  • 25
2
votes
2 answers

Can't Save hasMany/belongsTo Relationship if Both Are New in Ember-Data

I have two models. App.Request = DS.Model.extend({ materials: DS.hasMany('App.Material') }); App.Material = DS.Model.extend({ request: DS.belongsTo('Mat.Request') }); In the form for creating a request, I create a new…
Josh Minzner
  • 560
  • 1
  • 5
  • 13