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

Ember access model inside a controller

How can a model be accessed from within a controller ? Currently using the below code returns a "undefined is not a function" (go figure JS fail...). models/plan.js import DS from 'ember-data'; export default DS.Model.extend({ name: …
Bogdan Zurac
  • 6,348
  • 11
  • 48
  • 96
10
votes
6 answers

Ember-data find record by id and also additional parameters?

In the Ember docs I found that find() has support for finding by id: this.store.find('post', 1); // => GET /posts/1 And also by passing arbitrary parameters: this.store.find('post', { name: "Peter" }); // => GET to /posts?name='Peter' But in my…
Edy Bourne
  • 5,679
  • 13
  • 53
  • 101
10
votes
6 answers

ember-data: How to tell if a model's async: true relationship is loaded without triggering a load?

I need to check if an async relationship has been loaded without triggering the load, is this possible?
Rhinon
  • 337
  • 1
  • 3
  • 8
10
votes
2 answers

Ember: Get current adapter from model

I'm inside of a DS.Model-extending class and want to get the current adapter instance. I found some code here: App.__container__.lookup('adapter:application') But it looks quite hacky and I'm wondering whether there's a more correct way.
lucas clemente
  • 6,255
  • 8
  • 41
  • 61
10
votes
2 answers

How can I have multiple ajax calls in one route?

I'm trying to get two get 2 lists of blog posts from 2 categories (news and events), then display them in 2 different columns of my home page. It is required for me to perform 2 separate Ajax calls to get those blog posts. I do not use ember-data…
Pedro
  • 3,511
  • 2
  • 26
  • 31
10
votes
3 answers

EmberJS - record with hasMany relation fails to load

I am using EmberJS 1.0.0 with Ember Data 1.0.0 beta and the latest version of the LocalStorage Adapter. When I try to load a record with a hasMany relationship from the store I get the follwing error: ember-1.0.0.js (Line 394) Assertion failed: You…
Alex
  • 12,205
  • 7
  • 42
  • 52
10
votes
2 answers

How can I look up models in the console with Ember Data 1.0.0-beta.1?

App.User.find() is now this.store.find(), so how do I get there from the console?
10
votes
1 answer

Emberjs with a Java REST backend

I am looking into Java (possibly Scala) for a project that will use Ember and ember-data. I know I can write a backend to format the JSON, but I was wondering if there are any Java packages for Java more capable for building the JSON strings in a…
awildeep
  • 115
  • 1
  • 8
10
votes
7 answers

Ember.js Data how to clear datastore

I am experiementing with Ember.js and have setup a small app where users can login and logout. When the user logs out I want to clear all of the currently cached records in the Data Store. Is there a way to do this or would I have to force the…
rundeks
  • 103
  • 1
  • 1
  • 5
10
votes
3 answers

EmberJS: change url for loading model (ember-data)

I have problems with ember-data. For example, I've created a project at http://localhost/~me/test In my project I've created a store and a model as follows: ... init stuff here ... var attr = DS.attr; App.Person = DS.Model.extend({ firstName:…
Jeanluca Scaljeri
  • 26,343
  • 56
  • 205
  • 333
10
votes
4 answers

Ember-Data: How to use `DS.Adapter.findHasMany`

UPDATE Note that this question applies to Ember Data pre-1.0 beta, the mechanism for loading relationships via URL has changed significantly post-1.0 beta! I asked a much longer question a while back, but since the library has changed since then,…
S'pht'Kr
  • 2,809
  • 1
  • 24
  • 43
10
votes
1 answer

How to create a custom Serializer for Ember data

I have an API that returns JSON that is not properly formatted for Ember's consumption. Instead of this (what ember is expecting): { events: [ { id: 1, title: "Event 1", description: "Learn Ember" }, { id: 2, title: "Event 2", description:…
Robin
  • 21,667
  • 10
  • 62
  • 85
10
votes
1 answer

Does ember-data really support nested urls?

I have a top level session object that can have many speakers under it. My REST ish endpoint allows me to get all the sessions like so /sessions/ I can get all the speakers for a given session like so /sessions/1/speakers/ With the current version…
Toran Billups
  • 27,111
  • 40
  • 155
  • 268
10
votes
1 answer

DS.Model date attribute parses date (YYYY-MM-DD) incorrectly

I am having a issue with my DS.Model parsing dates in the format of "YYYY-MM-DD". They are always one day behind. Here is an example: http://jsfiddle.net/ZUV8v/ Using Date objects on the console I get similar results > new Date('2012-09-20') Wed Sep…
Aaron Renoir
  • 4,283
  • 1
  • 39
  • 61
10
votes
4 answers

What should my Rails routes look like to work with pushState Ember.js routes?

In short... When building an Ember.js app to persist to a Rails app, how should I handle Rails routing/views? I would think I just need Rails to render the application.html.erb layout so the Ember.js app initializes and handles the…
David
  • 1,330
  • 17
  • 31