ember-data

Ember model not updated

丶灬走出姿态 提交于 2019-12-11 11:35:45
问题 I have a route that displays a list of challenges, when I create a new challenge the record is persisted however the model of list of challenges is not updated when I transition back into the route. Is there something I am missing? //new.js var challenge = this.store.createRecord('challenge', { name_en: this.get('model.name_en'), name_fr: this.get('model.name_fr'), description_en: this.get('model.description_en'), description_fr: this.get('model.description_fr'), end_date: this.get('model.end

creating records of self referring model causing error

橙三吉。 提交于 2019-12-11 11:28:51
问题 I have self referring model defined as : App.Answer = DS.Model.extend({ name: DS.attr('string'), parentAnswer: DS.belongsTo('answer'), childAnswers: DS.hasMany('answer') }); I am not sure how to define the inverse property to get things working. Here is a jsbin of what I have : http://jsbin.com/oKezUkaz/1/ If we add a group(pressing "Add group" button) we get error in the console saying: Assertion failed: You defined the 'childAnswers' relationship on App.Answer, but multiple possible inverse

Uncaught Error: Could not find module `-private/system/references/record` imported from `ember-data/-private/system/references`

馋奶兔 提交于 2019-12-11 11:26:49
问题 When I upload my demo project, built with the following command: ember build --environment=production with data coming from ember-cli-mirage (configured to work also in production, with the method mentioned here: http://www.ember-cli-mirage.com/docs/v0.1.x/server-configuration/#environment-options I get this error: Uncaught Error: Could not find module `-private/system/references/record` imported from `ember-data/-private/system/references` I'm not sure which files would be relevant here I

How do I upgrade ember-data to a specific sha in ember-cli?

纵饮孤独 提交于 2019-12-11 11:18:34
问题 I want to lock down my ember-cli project's version of ember-data to this commit, which updates the map function signatures and lets ED work with Ember 1.8. I tried using the canary instructions as a template and doing this, and adding this to my bower.json : "ember-data": "components/ember-data#f97d5c9adbabd7f6b4935e614bc95e49b66bb7e0", and "resolutions": { "ember-data": "#f97d5c9adbabd7f6b4935e614bc95e49b66bb7e0" } but I'm getting the following error: Additional error details: fatal:

Ember Data Model rollback not working on custom attribute of model

时间秒杀一切 提交于 2019-12-11 11:04:19
问题 I have this JS bin. Does anyone know the reason why, when I modify the user model and click the button to rollback, why the firstName property is being rolled back but not the array custom attribute? Thanks. http://emberjs.jsbin.com/nunihuco/1/edit?html,js,console,output 回答1: Ember Data watches the property itself. The property itself isn't changing, your data inside is. You'd need to change the property for it to be able to rollback . this.set('model.listOfStuff', ['hello','world']); http:/

Sort Ember Object Array with Promises

无人久伴 提交于 2019-12-11 10:57:12
问题 I have a model model/person { firstName: DS.attr( 'string'), lastName: DS.attr( 'string'), email: DS.attr( 'string' ), } and another model model/project { name: DS.attr( 'string' ), code: DS.attr( 'string' ), startDate: DS.attr( 'date' ), endDate: DS.attr( 'date' ), users : DS.hasMany('person', {async: true}), } then i'm retrieving all the projects with as an array which contains ember objects. since the project -> users is async its a promise. and i want to sort that array using the first

my computed values stopped working with latest version of ember-data.js

别来无恙 提交于 2019-12-11 10:57:11
问题 I am getting the following error when i change attributes of a model. Uncaught Error: <DS.StateManager:ember466> could not respond to event setProperty in state rootState.loading. Here is the code. http://jsfiddle.net/arenoir/JejwD/ http://jsfiddle.net/arenoir/JejwD/show 回答1: Since revision 6 of ember-data (see breaking changes), IDs are string-normalized. As a result, you'll need to update your fixtures to use strings for IDs (note: the REST adapter will convert numbers/strings, but the

Ember.js: select state not saved in URL when reload page

笑着哭i 提交于 2019-12-11 09:40:35
问题 There are select on the page for choosing country and it's need to save selected value in URL. I declared query params in route-driven controllers. It's all work! If country select is changed then url also changed. Demo: http://output.jsbin.com/releza But if I reload page with some valid GET params then it params convert to 'undefined'. For example, I try to load page http://output.jsbin.com/releza#/?country=2 and it redirect to http://output.jsbin.com/releza#/?country=undefined Why? # index

deleteRecord with multiple belongsTo relationships in ember-cli

依然范特西╮ 提交于 2019-12-11 08:43:43
问题 What is the ember-cli best practice to deleteRecord() on a model that belongsTo multiple models? Do I have to manually clean up relationships on the parents? Migrating from ember to ember-cli I am having new trouble with deleteRecord() for a model 'star' that belongsTo multiple models, 'post' and 'user'. Before moving to ember cli it was working with this solution. The previous solution's delete action fails in the current ember-cli with errors and never calls the api . TypeError: Cannot read

Ember Data: child records disappear from screen after one flash when created

老子叫甜甜 提交于 2019-12-11 08:42:14
问题 I have a Todo-App with a list of checkboxes after each task. I'm using a hasmany relation between task and checkboxes. Todos.Todo = DS.Model.extend({ title: DS.attr('string'), quarters: DS.hasMany('quarter',{async:true}) }); Todos.Quarter = DS.Model.extend({ filled: DS.attr('boolean'), todo: DS.belongsTo('todo') }); When I create a new task with new child records the new checkboxes flash one time on the screen and then disappear. This happens when I'm using the FixtureAdapter. Here's a