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
16
votes
1 answer

Request Two Models together

I have two models that are many to many. They're used on the first page of my app and I'm having trouble loading them. Both models only have a handful of items (<200) and I'd like to just load both models completely in one findAll request each. But…
NicholasJohn16
  • 2,390
  • 2
  • 21
  • 45
16
votes
6 answers

What's the standard pattern for ember-data validations? (invalid state, becameInvalid...)

I've kinda been struggling with this for some time; let's see if somebody can help me out. Although it's not explicitly said in the Readme, ember-data provides somewhat validations support. You can see that on some parts of the code and…
josepjaume
  • 419
  • 5
  • 15
15
votes
2 answers

Assertion Failed: You must include an 'id' for account in an object passed to 'push' Ember.js v-2.4

I'm new to Ember and I can't find anywhere a solution to my problem. I have read the questions here in stack and in other ember forums, but none of them seems to work for me. I'm trying to create a simple signup form. I should note that for the…
Jack
  • 239
  • 1
  • 2
  • 12
15
votes
2 answers

Ember - How to get route model inside route action

Is it possible to access route model inside route action? I am passing multiple objects inside a route model to template, model: function() { return { employeeList : this.store.findAll("employee"), employee :…
Manu Benjamin
  • 987
  • 9
  • 24
15
votes
1 answer

Delete JSON root element for POST/PUT operations in Ember Data

I'm consuming a web service that in POST/PUT verbs expects a JSON like this: { "id":"CACTU", "companyName": "Cactus Comidas para llevar", "contactName": "Patricio Simpson", "contactTitle": "Sales Agent", "address": "Cerrito…
Merrin
  • 514
  • 7
  • 20
15
votes
4 answers

Ember Data - Saving record loses has many relationships

I am having an issue working with Ember Data Fixture Adapter. When saving a record, all of the record's hasMany associations are lost. I have created a simple JS Bin to illustrate the issue: http://jsbin.com/aqiHUc/42/edit If you edit any of the…
delwyn
  • 664
  • 4
  • 10
15
votes
2 answers

Proper way to save to a hasMany relationship using ember data

I have some related models in my ember.js app (using Ember 1.0 and EmberData 1.0 RC2): App.List = DS.Model.extend({ listName : DS.attr( ), cards : DS.hasMany( 'card', { async : true } ) }); and App.Card = DS.Model.extend({ description…
bittersweetryan
  • 3,383
  • 5
  • 28
  • 42
15
votes
4 answers

How to get Ember Data's "store" from anywhere in the application so that I can do store.find()?

With the recent update, I know that in routers and controllers, I can easily just do this.store.find('model'). However I have some functions that need to call find that are not in routers and controllers. So how can I get an instance store from…
HaoQi Li
  • 11,970
  • 14
  • 58
  • 77
15
votes
2 answers

How to implement complex queries with a REST api?

I'm building an EmberJS app using ember-data. Some of the functionality in my app requires quite complex queries. As an example, let's say I have three entities - students, teachers and classes. If I wanted to get a list of all the students born…
Anonymous
  • 6,181
  • 7
  • 45
  • 72
15
votes
5 answers

Using primary keys with Ember Data

I've been struggling for the past few days with primary keys and the last version of Ember Data. I first read how to do it on the Breaking Changes file on GitHub, but it's apparently outdated. I tried several other ways (with the help of Peter…
Benjamin Netter
  • 1,501
  • 3
  • 18
  • 34
15
votes
1 answer

Accessing controllers from other controllers

I am building a project management app using ember.js-pre3 ember-data revision 11. How do I initialize a couple of controllers and make them available globally. For example I have a currentUser controller and usersController that I need access to in…
Aaron Renoir
  • 4,283
  • 1
  • 39
  • 61
14
votes
1 answer

Instance initializer unit test fails with "store is undefined"

After generating an example application: ember new preloadtest cd preloadtest/ ember g instance-initializer preload ember g model test-data ember g route index ember g adapter application With the following files: models/test-data.js import DS from…
MT0
  • 143,790
  • 11
  • 59
  • 117
14
votes
1 answer

How to use the new ember-cli http-mock for API calls

I have a simple (so far) ember-cli project, and right now just have one model with FIXTURE data. I would like to mock up API stuff, either with actual JSON files, or with http-mock, which is the ember-cli version 41 name of what used to be…
redOctober13
  • 3,662
  • 6
  • 34
  • 61
14
votes
2 answers

How do I make the parent dirty when I change a hasMany/belongsTo relationship in Ember-Data?

My main problem with Ember Data, right now, is that when I change a relationship (hasMany or belongsTo), the parent doesn't get dirty. I need this because: I'm depending on the isDirty property to show a save/cancel button hasMany and belongsTo ids…
miguelcobain
  • 4,734
  • 4
  • 32
  • 45
14
votes
3 answers

Ember model reloading in interval

I have a User model, which has latitude and longitude properties, which are used to show current user location on map. App.User = DS.Model.extend({ firstName: DS.attr('string'), lastName: DS.attr('string'), email: DS.attr('string'), …
lazzi
  • 435
  • 4
  • 12