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.

5458 questions
18
votes
3 answers

creating a record with Ember.js & Ember-data & Rails and handling list of records

I'm building an app which has layout like below. I want to create a new post so I pressed 'new post button' and it took me to 'posts/new' route. My PostsNewRoute is like below (I followed the method described here) App.PostsNewRoute =…
synthresin
  • 931
  • 1
  • 9
  • 23
18
votes
3 answers

Sample app using Ember Data and Rails backend

Any sample app using ember data to recommend ? Ideally with Rails backend and models associations.
17
votes
1 answer

Get the first record of model in emberjs

I need a way to get first record of specific model .at this time im using a way like this : this.store.findAll('configModel').then(function(items) { items.get('content')[0].set('isEnableShowUniqueName', true); …
MBehtemam
  • 6,516
  • 11
  • 56
  • 98
17
votes
2 answers

persisting parent and embedded record in ember-data

I have the following models: App.Company = DS.Model.extend({ name: DS.attr('string'), accounts: DS.hasMany('App.Account', { inverse: 'company' }) }); App.Account = DS.Model.extend({ login: DS.attr('string'), …
marcoow
  • 4,012
  • 1
  • 11
  • 21
17
votes
2 answers

What's the proper way to access parameters from within Ember.Route. setupController?

Ember.Route.model has access to the params variable, but Ember.Route.setupController does not. This is troublesome for me, because my path has multiple dynamic segments, and I need to use all of them in my template. Specifically, my path looks like…
NudeCanalTroll
  • 2,200
  • 2
  • 18
  • 41
17
votes
2 answers

ember Uncaught Error: assertion failed: Emptying a view in the inBuffer state

I get this assertion when run the code below: Emptying a view in the inBuffer state is not allowed and should not happen under normal circumstances. Most likely there is a bug in your application. This may be due to excessive property change …
user1613807
17
votes
4 answers

How to make embedded hasMany relationships work with ember data

I can't get embedded hasMany to work correctly with ember data. I have something like this App.Post = DS.Model.extend({ comments: DS.hasMany('App.Comment') }); App.Comment = DS.Model.extend({ post: DS.hasMany('App.Post'), name:…
Riad
  • 235
  • 1
  • 3
  • 7
17
votes
1 answer

ember-data: Loading hasMany association on demand

(Updated for ember-data API Rev 11...) TL;DR What is the right way to use DS.Adapter.findAssociation(...)DS.Adapter.findHasMany(...) to load hasMany associations on demand? Especially, once you load child records, how do you deal with the fact that…
S'pht'Kr
  • 2,616
  • 1
  • 21
  • 40
17
votes
3 answers

Where do I specify the pluralization of a model in Ember Data?

I have a model type that ends in -y: Security How do I tell Ember Data to use /securities instead of /securitys to find resources for this?
outside2344
  • 1,959
  • 1
  • 26
  • 50
16
votes
3 answers

How to prevent Ember Data from saving attribute (ie., Read-only attribute)

I am creating an online form builder using Ember 2.0 on the front-end and Rails 4.2 on the back-end with the json_api_resources gem. In the process of publishing a form, a user must be able to cut/paste a snippet of code into his/her webpage in…
16
votes
1 answer

Conventions required of RESTful JSON API to be usable with Ember

In the Ember Models Introduction, it is mentioned: Without any configuration, Ember Data can load and save records and their relationships served via a RESTful JSON API, provided it follows certain conventions. I'm getting started trying to…
Code Poet
  • 10,615
  • 18
  • 60
  • 94
16
votes
4 answers

emberjs Cannot clone an Ember.Object that does not implement Ember.Copyable

I am using ember 1.3.1 and ember-data 1.0.0-beta.5. On creating new mode I get following error Assertion failed: Cannot clone an Ember.Object that does not implement Ember.Copyable Following is my model code App.myModel = DS.Model.extend({ …
amique
  • 1,955
  • 4
  • 26
  • 49
16
votes
1 answer

How do you access RESTAdapter's host and namespace inside a route or controller?

I have a few custom AJAX requests that I use inside of some controllers and routes, for example: var loginRoute = Ember.Route.extend({ actions: { submitLogin: function(user, pass) { var data = { username: user, password: pass }; …
Joe B
  • 961
  • 9
  • 19
16
votes
3 answers

how to paginate ember-data relationships

How do you paginate the request for related data? For example, if my Person has a thousand Task models attached to it if I do the following, in RESTful thinking, I would get all of them. var tasks = person.get('tasks'); That would be way too much…
David
  • 8,948
  • 16
  • 63
  • 116
16
votes
2 answers

Ember component sendAction() not working

i have been struggling with this for the past few hours, i am making an ember application for creating an invoice. i am using ember component (textfield) to modify the fields using the keyboard, but since actions are not sending back to the relevant…
Wilhearts
  • 169
  • 1
  • 1
  • 6