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
14
votes
2 answers

Ember-data in a non-RESTful environment

I would like to use ember-data in a project I am building, but the API I am working with does not follow REST conventions. For example, all the HTTP requests are POST and the naming conventions of the endpoints are unique to the actions they…
user1168427
  • 1,003
  • 3
  • 10
  • 16
14
votes
2 answers

The right pattern for returning pagination data with the ember-data RESTAdapter?

I'm displaying a list of articles in a page that are fetched using the Ember Data RESTAdapter. I need to implement a bootstrap'esque paginator (see: http://twitter.github.com/bootstrap/components.html#pagination) and cant seem to find a sane pattern…
Tyler Love
  • 151
  • 1
  • 6
14
votes
1 answer

How to add objects to a hasMany relationship with ember data

I have these two models: App.Items = DS.Model.extend({ provider: DS.attr('string'), name: DS.attr('string'), description: DS.attr('string'), }); App.Baskets = DS.Model.extend({ selectedItems: DS.hasMany('App.Items'), name:…
George Eracleous
  • 4,278
  • 6
  • 41
  • 50
14
votes
4 answers

How to handle singular resources with RESTAdapter

How are singular resources handled in ember-data? Say I have the following RESTful routes: GET /cart POST /cart UPDATE /cart DELETE /cart ember-data expects find() to return an array, plus it automatically tries to pluralize any url I pass to my…
Nick Colgan
  • 5,488
  • 25
  • 36
14
votes
2 answers

How to subclass or inherit a model from another model using ember-data

Let's say my rails models look like this: class SalesRelationship < ActiveRecord end Which is inherited by crossSell like this: class crossSell < SalesRelationship end How do I show this inheritance relationship in ember-data. What is the best…
brg
  • 3,915
  • 8
  • 37
  • 66
14
votes
4 answers

Revert change to ember data model

Is there a way to revert a change to an Ember Data model easily? I have a model bound to an edit view. This view enables the user to cancel editing, at which point I'd like to revert the changes to the model. Is there an easy way to do this…
outside2344
  • 2,075
  • 2
  • 29
  • 52
13
votes
3 answers

DEPRECATION: The default behavior of shouldReloadAll will change in Ember Data 2.0 to always return false when there is at least one

At the moment of this question i'm running the latest Ember and Ember Data versions. I'm working with the DS.RESTAdapter calling for a /places this way: this.store.findAll('place'); The model only have a name attribute name: DS.attr('string') The…
Javier Cadiz
  • 12,326
  • 11
  • 55
  • 76
13
votes
1 answer

How to run action in Ember Controller afterRender

I am new to ember framework. I just want to execute a function that is defined inside the actions hook after the rendering completes. var Controller = Ember.Controller.extend({ actions: { foo: function() { console.log("foo"); } …
Mohan Kumar
  • 621
  • 1
  • 8
  • 25
13
votes
2 answers

Overwrite DS.Store ember-cli

I have some code that needs to run on store.init. I tried extending the default store in app/store.js, ember-cli seems to pick it up as a store, but the object in this.store is not a store My store definition: import DS from 'ember-data'; export…
Billybonks
  • 1,568
  • 3
  • 15
  • 32
13
votes
1 answer

How to set rest adapter in ember cli generated model

I am trying to get my ember model to use a remote rails api. I've tried extending DS.RESTAdapter but I don't know how to tell the model to use those settings. My model never reaches out to localhost:3000. //app.js import Ember from…
MikeV
  • 657
  • 1
  • 8
  • 20
13
votes
4 answers

Ember Data belongsTo with Select dropdown view

I am trying to do something pretty basic with Ember and Ember Data. 1) Posts belongsTo Users; Users hasMany Posts 2) In the create new Post form, I want to have a select/dropdown of all Users 3) When I edit a post (using the same form), I want to…
Min Ming Lo
  • 2,398
  • 2
  • 18
  • 25
13
votes
3 answers

Ember without Ember Data

Ember data is still not at version 1.0 and thus I decided to use Ember without Data models. I have my own models, and those are created by the route model function. However maintaining state between the frontend objects and the backend objects is a…
Dory Zidon
  • 10,497
  • 2
  • 25
  • 39
13
votes
1 answer

Manually remove record from ember data store

I am using ember and ember data in my application . How can we remove manually a record from the store in Ember . Currently i am pushing the record to store using push method . I have some issues with ember data save , so i used ajax function for…
maheshiv
  • 1,778
  • 2
  • 17
  • 21
13
votes
3 answers

Ember 1.0.0 RESTAdapter failure

I can't seem to track down the source of this error: Assertion failed: No model was found for '0' The JSON is getting fetched by the server, but the app is erroring out before it gets sent to the template. The problem seems to be happening between…
buzz mckinnon
  • 133
  • 1
  • 4
13
votes
1 answer

How to add header for all RESTAdapter ember requests

The API needs to specify api version application/vnd.api+json;version=1, also it needs secure x-app-id and x-app-secret. Is there a way to specify that in RESTAdapter in Ember? After Trying request header App.Adapter = DS.RESTAdapter.extend({ …
Seif Sallam
  • 821
  • 2
  • 10
  • 30