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

serialize date attributes

I am using active_model_serializers and ember.js. One of my models has a date attribute. In rails date attributes are serialized in the format of "YYYY-MM-DD". The problem; when ember-data de-serializes the date using the javascript Date…
Aaron Renoir
  • 4,283
  • 1
  • 39
  • 61
9
votes
1 answer

return single record with ember-data find() and multiple params

I'm trying to do a find (with ember-data) on other params than the id, two params actually. but all i get back is: "Uncaught Error: assertion failed: Your server returned a hash with the key customer but you have no mappings". After digging around…
Kim Fransman
  • 145
  • 2
  • 6
9
votes
9 answers

Ember-data and MongoDB, how to handle _id

I'm using ember-data with rails and MongoDB and am having problem with the way IDs are stored in MongoDB - in a _id field. Ember-data will use id as the default field for ID so I tried to override it like this: App.User = DS.Model.extend …
Charlie
  • 10,227
  • 10
  • 51
  • 92
8
votes
4 answers

Adding item to filtered result from ember-data

I have a DS.Store which uses the DS.RESTAdapter and a ChatMessage object defined as such: App.ChatMessage = DS.Model.extend({ contents: DS.attr('string'), roomId: DS.attr('string') }); Note that a chat message exists in a room (not shown…
rlivsey
  • 2,124
  • 2
  • 18
  • 21
8
votes
2 answers

Ember Data: create Model without store

Is there a way to create a DS.Model object without using store.createRecord ? EDIT maybe I need to give some context. I am writing an Ember Addon that has a few model that are not bridged through the app/ directory and I want to write unit tests…
Sang Park
  • 382
  • 2
  • 17
8
votes
2 answers

Save multiple model at once, in bulk

I know this subject has already been discussed around stackoverflow and other forums, but I cannot find the right way to do it. I have a model called "post" which contain post information (user, description, etc...). The user receive a few post,…
alexmngn
  • 9,107
  • 19
  • 70
  • 130
8
votes
1 answer

EmberJS embedded items in payload JSONAPI

Ember : 1.13.3 Ember Data : 1.13.5 jQuery : 1.11.3 I am trying to send a JSON payload using ember-data from my EmberJS client to my server. I want to send the entire object graph to the server on saving the project, as I don't want to send…
Asagohan
  • 583
  • 5
  • 19
8
votes
4 answers

How can I pass an array property to an Ember component?

My Ember component looks like this: import Ember from 'ember'; export default Ember.Component.extend({ users: undefined, primaryAction: 'follow', leftSubDetails: [], rightSubDetails: [], onInitialization: function(){ …
Ahmed Abbas
  • 952
  • 11
  • 25
8
votes
4 answers

Ember.js - Get all model names

I'm trying to to get a list of all defined models in my Ember application (v1.8). As far as I can tell from my research, the Container.resolver works with some mysterious magic. Does the Container have a list of all active models, or is there any…
medokin
  • 610
  • 9
  • 21
8
votes
1 answer

How to use Ember Data with Nested Resources

My application backend has several resources. A model is exposed for each resource. The entry point to all other resources is through the User model. What I mean is, given a User we can find BlogPost. Given a BlogPost we can find Comments etc. In…
Code Poet
  • 11,227
  • 19
  • 64
  • 97
8
votes
1 answer

Ember Data: Overriding Save method

Hello Ember Data World, I have been studying custom adapters attempting to figure out how to override the save method. From my understanding, it seems like you need to do something like this: DS.RESTAdapter.extend({ save: function() { return…
joker1979
  • 181
  • 2
  • 12
8
votes
1 answer

Ember.js: How can I prevent transition on dirty model with async confirmation?

I have a pretty common situation: there is a dirty model and I want to show a confirmation if user tries to transition to any other route. I have something like this to work with window.confirm confirmation dialog: var EventRoute =…
8
votes
3 answers

Model reloading with Ember Data

I'm trying to poll for more data using the documented model.reload() function App.ModelViewRoute = Ember.Route.extend({ actions: { reload: function() { this.get('model').reload(); } } }); But i'm getting an error message…
Chris
  • 1,054
  • 2
  • 12
  • 24
8
votes
2 answers

Returning record(s) after store pushPayload call

Is there a better way to return the record(s) after DS.Store#pushPayload is called? This is what I'm doing... var payload = { id: 1, title: "Example" } store.pushPayload('post', payload); return store.getById('post', payload.id); But, with regular…
tonycoco
  • 531
  • 7
  • 9
8
votes
2 answers

How to return a promise composed of nested models in EmberJS with EmberData?

Enviroment # Ember : 1.4.0 # Ember Data : 1.0.0-beta.7+canary.b45e23ba Model I have simplified my use case to make the question easier to understand and anwser. Let's assume we have 3 models: Country, Region and Area: Country: - id:…
ioleo
  • 4,697
  • 6
  • 48
  • 60