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

Ember data Doing a general search on a Model after some instances have been added to a relationship

I have these basic models (super simplified to show the problem): App.Alert = DS.Model.extend({ recipients: DS.hasMany('App.Person') }) App.Person = DS.Model.extend({ name: DS.attr("string") }) Then I try and execute the following: var…
Staale
  • 27,254
  • 23
  • 66
  • 85
2
votes
1 answer

How to add array of objects to a newly created object with a hasMany relationship in Ember?

Take the following example: //Parent object: App.Parent = DS.Model.extend({ children: DS.hasMany('child'); name: DS.attr('string'); }); //Child object: App.Child = DS.Model.extend({ parent: DS.belongsTo('App.Parent'); name:…
Anonymous
  • 6,181
  • 7
  • 45
  • 72
2
votes
2 answers

Ember.js: How to sync model to a different namespace from the default

In my store.js.coffee, I'm setting the namespace for my API: DS.RESTAdapter.reopen namespace: "api/v1" That's the base namespace I want to use for my ember-data API calls to Rails Active Model Serializers. But in some API calls, I want my model…
Chris
  • 824
  • 1
  • 7
  • 26
2
votes
2 answers

ember-data findAll returns 0 records on first request

Where is the best place to boot strap ember-data in order to fill the store: I am currently using revision 13 of ember-data. At the moment I am trying this in the ApplicaitonRoute: App.ApplicationRoute = Ember.Route.extend setupController: -> …
dagda1
  • 26,856
  • 59
  • 237
  • 450
2
votes
1 answer

Model attributes null, even after mapping

I'm implementing a custom Adapter for non-conforming JSON data. The data is being pulled in, but the attributes are not being materialized. I have the following map: // map function has not been overridden - RESTAdapter is…
knownasilya
  • 5,998
  • 4
  • 36
  • 59
2
votes
1 answer

How to convert an emberjs Object to JSON in Ember 1.0.0-RC3

I need to pass JSON to jquery-fullcalendar and though I can pass use url as the source from which to fetch the JSON, I would prefer to convert data already loaded into ember-data store to JSON and pass it to fullcalendar, so any changes made on the…
brg
  • 3,915
  • 8
  • 37
  • 66
2
votes
1 answer

How to create dynamic fixtures for ember integration tests using ember-testing (Qunit) via teabag

I have setup the rather awesome teabag https://github.com/modeset/teabag to run integration tests on my ember app. I am following the process that Erik Bryn discussed in his presentation: http://www.youtube.com/watch?v=nO1hxT9GBTs using the code in…
i0n
  • 916
  • 1
  • 8
  • 26
2
votes
3 answers

Ember data model created with createRecord with no params does not appear

We have an example ember app where we CRUD recipes. For the route where we create a new Recipe, if we pass attributes into createRecord like so: Cookbook.RecipesNewRoute = Ember.Route.extend model: -> Cookbook.Recipe.createRecord(title:…
2
votes
1 answer

Is there a way to get access to the Ember model within a nested view?

I'm trying to get access to the model for an ember model object that I'm currently editing. I'm rendering a view: {{view App.RemarkTextField valueBinding="content"}} And here's the view: App.RemarkTextField = Ember.TextField.extend …
Faun
  • 614
  • 6
  • 17
2
votes
1 answer

How to load Ember Data data when app starts?

As a follow up to my another question (I think this one is more specific) I'd like to ask you how can I load data when an app starts. I need some cache strategy. The data that is presented in our internal app is refreshed once a week so that I don't…
wryrych
  • 1,765
  • 4
  • 20
  • 31
2
votes
1 answer

Get object from belongsTo relationship

Let's say I have some model like: App.Employee = DS.Model.extend({ name: DS.attr('string'), department: DS.belongsTo('App.Department') }); In my controller I can say var name = thisEmployee.get('name'); But I can't say var department =…
onezeno
  • 764
  • 1
  • 10
  • 21
2
votes
3 answers

Reserved attribute names in Ember.js models

I have a Post model with the following fields: BlogApp.Post = DS.Model.extend({ author: DS.attr('string'), title: DS.attr('string'), preamble: DS.attr('string'), content: DS.attr('string'), created: DS.attr('date'), comments:…
Paulo Scardine
  • 73,447
  • 11
  • 124
  • 153
2
votes
0 answers

Iterating over records of a model without knowing the model

Hi I try to create a gui for the all (ember-data) models used in my application. Thats my router: App.Router.map(function () { this.resource('config', function() { this.resource('configModel', {path: ':configModel'}); }); In config I…
daniatic
  • 502
  • 4
  • 18
2
votes
1 answer

ember.js dynamic route issue

I have App.User and App.Contact models that are identical and inherit from a a base class: App.Person = DS.Model.extend({ firstName: DS.attr('string'), surname: DS.attr('string'), email: DS.attr('string'), fullName: function(){ …
dagda1
  • 26,856
  • 59
  • 237
  • 450
2
votes
2 answers

How to re-render a template using a cached property in ember.js?

I have a route that finds a day object using day of week //assume I have a configuration model for 7 days (1 for each week day basically) var day_of_week = ev.date.getDay() + 1; var model = App.Day.find(day_of_week); model.set('date',…
Toran Billups
  • 27,111
  • 40
  • 155
  • 268