ember-data

ember-data DS.RESTAdapter causes TypeError

…衆ロ難τιáo~ 提交于 2020-01-14 14:32:50
问题 I'm trying out Ember.js with ember-data, and I have the following application defined: window.App = Ember.Application.create() App.store = DS.Store.create revision: 4 adapter: DS.RESTAdapter.create { bulkCommit: false } App.Source = DS.Model.extend # options primaryKey: '_id' # fields name: DS.attr 'string' raw_text: DS.attr 'string' App.sourcesController = Ember.ArrayProxy.create content: App.store.findAll App.Source App.ListSourcesView = Ember.View.extend templateName: 'app/templates

Ember model only loads last record

时间秒杀一切 提交于 2020-01-14 13:36:30
问题 I'm trying to reproduce Railscasts 410 example (called Raffler ), changing the setup for last versions and to match my habits: Ember 1.0.0-rc.6 Rails 4.0.0 Mongoid master (4.0) Haml 4 Emblem 0.3.0 In this example project, we create a simple model Entry that calls a small Rails Rest API. Everything works as expected, except that calling Raffler.Entry.find() to get all entries only loads the last record. Here is my model : Raffler.Entry = DS.Model.extend name: DS.attr('string') winner: DS.attr(

Ember model only loads last record

Deadly 提交于 2020-01-14 13:36:10
问题 I'm trying to reproduce Railscasts 410 example (called Raffler ), changing the setup for last versions and to match my habits: Ember 1.0.0-rc.6 Rails 4.0.0 Mongoid master (4.0) Haml 4 Emblem 0.3.0 In this example project, we create a simple model Entry that calls a small Rails Rest API. Everything works as expected, except that calling Raffler.Entry.find() to get all entries only loads the last record. Here is my model : Raffler.Entry = DS.Model.extend name: DS.attr('string') winner: DS.attr(

Ember Data delete fails, how to rollback

不问归期 提交于 2020-01-14 08:35:47
问题 If I call destroyRecord and it fails on the server, it also disappears from the local store and from the UI. I need to somehow "rollback" if delete fails. I have tried something like this. item.destroyRecord().then(function () { Notify.success("item removed"); }).catch(function (response) { //NEED TO ROLLBACK HERE - ANY IDEAS? Notify.error('Failed to remove!'); }); 回答1: Firstly, rollback with relationships doesn't fully work in ember data, secondly the newer versions of ember data handle this

with Ember Data, how do you call commit?

北城以北 提交于 2020-01-14 02:51:33
问题 I am trying to build a simple Todo List using all the last routes and data stuff for ember. You can find my full repo here I have my store set up like so: EmberTodo.Store = DS.Store.extend({ revision: 11, adapter: DS.RESTAdapter.create({bulkCommit: false}) }); The line of code that is giving me trouble comes from here: EmberTodo.CreateItemView = Ember.TextField.extend({ insertNewline: function() { EmberTodo.Item.createRecord({description: this.get('value')}); this.set("value", ""); } }); From

Authentication failed - Permission Denied with EmberFire

非 Y 不嫁゛ 提交于 2020-01-14 01:47:03
问题 I'm trying to set up a basic datastore at firebase when following simple beginner tutorials on Ember js 2.0. For example I am following this tutorial: https://medium.com/@jamesfuthey/a-gentle-introduction-to-ember-2-0-8ef1f378ee4#.d6umfj62j I always seem to have a problem with authentication with the Firebase URL. That is, I've gotten to the bit where this tutorial tries to write information to my firebase project, but the Chrome Inspector shows I'm getting a 'permission denied' error from

Authentication failed - Permission Denied with EmberFire

限于喜欢 提交于 2020-01-14 01:46:07
问题 I'm trying to set up a basic datastore at firebase when following simple beginner tutorials on Ember js 2.0. For example I am following this tutorial: https://medium.com/@jamesfuthey/a-gentle-introduction-to-ember-2-0-8ef1f378ee4#.d6umfj62j I always seem to have a problem with authentication with the Firebase URL. That is, I've gotten to the bit where this tutorial tries to write information to my firebase project, but the Chrome Inspector shows I'm getting a 'permission denied' error from

Ember - Abort ajax request

廉价感情. 提交于 2020-01-13 20:22:31
问题 I want to know how to abort a request. For example, I issue App.MyModel.find() and later i want to cancel/abort it before it returns from server. I would expect something like this: var res = App.MyModel.find(); //request sent to server res.abort(); // abort the request before completion but this doesn't work - the returned object is a promise and there is neither abort nor cancel methods. Clarification I'm looking for how to call the abort method on the underlying XMLHttpRequest object. 回答1:

Ember - Abort ajax request

大兔子大兔子 提交于 2020-01-13 20:22:17
问题 I want to know how to abort a request. For example, I issue App.MyModel.find() and later i want to cancel/abort it before it returns from server. I would expect something like this: var res = App.MyModel.find(); //request sent to server res.abort(); // abort the request before completion but this doesn't work - the returned object is a promise and there is neither abort nor cancel methods. Clarification I'm looking for how to call the abort method on the underlying XMLHttpRequest object. 回答1:

Best way to namespace multiple or suit of emberjs apps

寵の児 提交于 2020-01-13 19:53:49
问题 First a Merry Xmas to you and thanks for helping with suggestions. My question is still on emberjs namespace but this time in the context of a suite of multiple emberjs apps which will be contained within multiple rails-engine, so that each emberjs app is a standalone app with its own controllers, models, views and routers. However, they will still need to share ember-data associations. These rails-engines will inturn be included in the main-rails app where each engine represents a major