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

EmberJS Service Injection for Unit Tests (Ember QUnit)

Specs: Ember version: 1.13.8 node: 0.10.33 npm: 2.13.4 I have import Alias from "../../../services/alias"; .... moduleFor("controller:test", "Controller: test", { integration: true, beforeEach: function() { …
Sam.E
  • 175
  • 2
  • 10
9
votes
2 answers

Ember Data does not allow duplicate entries in hasMany relationships

I have the following model: #order/model.coffee Order = DS.Model.extend { line_items: DS.hasMany 'product', {async: true} } At some point I want to add the some products to the order. I found that I can only add the product once, adding the same…
jd.
  • 4,057
  • 7
  • 37
  • 45
9
votes
2 answers

Get around: No 'Access-Control-Allow-Origin' header is present on the requested resource

I have to deal with a RESTful server which is not under my control. When I try to fetch the ID 1 record from it this is the error I get: XMLHttpRequest cannot load http://www.example.com/api/v1/companies/1. No 'Access-Control-Allow-Origin' header is…
wintermeyer
  • 8,178
  • 8
  • 39
  • 85
9
votes
2 answers

How to tell ember.js and ember-data version from ember-CLI?

Doing ember -v only shows ember cli version. How can you view ember.js version and ember data versions?
ahnbizcad
  • 10,491
  • 9
  • 59
  • 85
9
votes
3 answers

How to load belongsTo/hasMany relationships in route with EmberJS

In my EmberJS application I am displaying a list of Appointments. In an action in the AppointmentController I need to get the appointments owner, but the owner always returns "undefined". My files: models/appointment.js import DS from…
Karoline Brynildsen
  • 3,598
  • 6
  • 35
  • 45
9
votes
2 answers

Testing an ember-data model - can't find relationship

I am trying to test a model relationship in an ember-cli application but it keeps telling me: No model was found for 'rateType'. It appears that it can't find my models. Files ~app/models/account.js ~app/models/rate-type.js Account Model export…
jax
  • 37,735
  • 57
  • 182
  • 278
9
votes
4 answers

How do I setup the api-stub in an ember-cli app?

I’m setting up a basic app using ember-cli and am running into trouble with the api-stub with ember-data. I've referenced the api-stub README and have referenced the ember guides, but can't figure out what I'm missing. I’m a bit of a noob, so…
Joe
  • 3,352
  • 3
  • 20
  • 19
9
votes
1 answer

Success callback never triggered with Ember-Data save()

I am trying to use ember-data to get a simple registration form to save on my server. The call technically works, but the success callback is never trigger on the promise, and I have no idea why. The server receives the data from the front end and…
Michael O
  • 93
  • 1
  • 4
9
votes
3 answers

What does Ember Data expect in response to deleting a record?

I'm using Ember Data with the RESTful adapter with a rails backend. When I delete a record from Ember record.deleteRecord(); record.save() the DELETE request goes to the server and the model is deleted, but this error is printed to the javascript…
everett1992
  • 2,351
  • 3
  • 27
  • 38
9
votes
1 answer

Ember-data lazy load association with "links" attribute

I have a model Teacher which has many Students. The models are defined as follows: App.Teacher = DS.Model.extend({ email: DS.attr('string'), students: DS.hasMany('student') }); App.Student = DS.Model.extend({ teacher:…
yorbro
  • 1,107
  • 1
  • 9
  • 23
9
votes
2 answers

Reset ember-data FixtureAdapter store/models in tests

Our app uses ember-data with the FixtureAdapter. We're testing the model code (various JS calculations) using Jasmine and js-test-driver. Each it block creates its own set of records in a beforeEach block. This works fine with ember-1.0.0-rc.1 and…
9
votes
2 answers

Ember data saving a relationship

I'm having difficult saving a one-to-many relationship in ember data. I have a relationship like this: App.ParameterSet = DS.Model name: DS.attr("string") regions: DS.hasMany("App.Region") App.Region = DS.Model name:…
Charlie
  • 10,227
  • 10
  • 51
  • 92
9
votes
1 answer

Ember.js / Rails and associations: how to submit back to Rails a record and its associations?

Say you have two Rails models with association: class Foo < ActiveRecord::Base attr_accessible :name belongs_to :moo end class Moo < ActiveRecord::Base attr_accessible :name has_many :foos accepts_nested_attributes_for :foos end Thanks…
PJC
  • 997
  • 7
  • 21
9
votes
3 answers

How to access nested object in json with Ember data

I'm using Ember data and having a hard time figuring out get ember to recognize nested properties in my JSON response from the server. This is ember-1.0.0-pre.4.js. Currently, I've set up associated models with Ember data revision 11. Here the #…
Chris
  • 719
  • 1
  • 7
  • 22
9
votes
1 answer

Class inheritance in Ember Data hasMany associations

I'm trying to get Ember Data working with a hasMany association with class inheritance. Example in Ember code: var Person = DS.Model.extend({ name: DS.attr('string'), animals: DS.hasMany('Animal') }); var Animal = DS.Model.extend({ name:…
florish
  • 557
  • 5
  • 10