ember-data

Ember Data - Saving record loses has many relationships

冷暖自知 提交于 2019-12-30 00:35:26
问题 I am having an issue working with Ember Data Fixture Adapter. When saving a record, all of the record's hasMany associations are lost. I have created a simple JS Bin to illustrate the issue: http://jsbin.com/aqiHUc/42/edit If you edit any of the users and save, all the projects disappear. This is using Ember 1.0.0 and the latest canary build of Ember Data. I am not sure if I am doing something wrong or if this is an issue with Ember Data. Thanks 回答1: To answer my question, the DS

Ember Data - Saving record loses has many relationships

眉间皱痕 提交于 2019-12-30 00:35:18
问题 I am having an issue working with Ember Data Fixture Adapter. When saving a record, all of the record's hasMany associations are lost. I have created a simple JS Bin to illustrate the issue: http://jsbin.com/aqiHUc/42/edit If you edit any of the users and save, all the projects disappear. This is using Ember 1.0.0 and the latest canary build of Ember Data. I am not sure if I am doing something wrong or if this is an issue with Ember Data. Thanks 回答1: To answer my question, the DS

`needs` not waiting for data to be returned before rendering template

女生的网名这么多〃 提交于 2019-12-29 08:07:11
问题 I am trying to implement a controller needing another ( CampaignsNew needing AppsIndex ), which looks like App.CampaignsNewController = Ember.Controller.extend({ needs: ['appsIndex'] }); And in my CampaignsNew template I am showing it via {{#if controllers.appsIndex.content.isUpdating}} {{view App.SpinnerView}} {{else}} {{#each controllers.appsIndex.content}} {{name}} {{/each}} {{/if}} However controllers.appsIndex.content.isUpdating is never true. I.e. it attempts to show the data before it

`needs` not waiting for data to be returned before rendering template

瘦欲@ 提交于 2019-12-29 08:07:07
问题 I am trying to implement a controller needing another ( CampaignsNew needing AppsIndex ), which looks like App.CampaignsNewController = Ember.Controller.extend({ needs: ['appsIndex'] }); And in my CampaignsNew template I am showing it via {{#if controllers.appsIndex.content.isUpdating}} {{view App.SpinnerView}} {{else}} {{#each controllers.appsIndex.content}} {{name}} {{/each}} {{/if}} However controllers.appsIndex.content.isUpdating is never true. I.e. it attempts to show the data before it

Self-Join with Ember-Data

时光总嘲笑我的痴心妄想 提交于 2019-12-29 04:23:25
问题 Does anyone have any suggestions on how to manually create a self-join relationship using ember-data? If, for example, a user had many followers (other users), what would be the simplest way to build this data structure into ember-data? 回答1: Best way that we could find without going crazy was to proxy the self-join relationship with the relationship object, then just map that to the user. So if a user has many "users" through follows then you can do: App.User = DS.Model.extend name: DS.attr(

Ember without Ember Data

强颜欢笑 提交于 2019-12-28 02:06:12
问题 Ember data is still not at version 1.0 and thus I decided to use Ember without Data models. I have my own models, and those are created by the route model function. However maintaining state between the frontend objects and the backend objects is a nightmare. Especially when one route uses another routes models. How can this be achieved, should I write my own store and model find method? Should I use Ember Data (even though it's not at version 1.0 ?) perhaps an ETA on Ember Data 1.0 ? write

API formation for side loading only required associated data to ember data

扶醉桌前 提交于 2019-12-26 00:49:17
问题 Please check my previous question EMBER JS - Fetch associated model data from back-end only when required Related to the above question I need help on API formation in ruby on rails(JSON format: jsonapi.org) how to form the API for sideloading only students.records and link with data already available in ember-data store (school and students) 回答1: based on the comments in the other question, I think you're wanting something like GET /api/students?include=records But you need that filtered to

API formation for side loading only required associated data to ember data

不想你离开。 提交于 2019-12-26 00:49:05
问题 Please check my previous question EMBER JS - Fetch associated model data from back-end only when required Related to the above question I need help on API formation in ruby on rails(JSON format: jsonapi.org) how to form the API for sideloading only students.records and link with data already available in ember-data store (school and students) 回答1: based on the comments in the other question, I think you're wanting something like GET /api/students?include=records But you need that filtered to

Inverse relations not showing correctly sometimes

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 14:25:19
问题 I have two models, Issues and Users. Issues have two properties that belongs to User, owner and creator. When the issues/index.hbs template renders the issues, some owner and creator are correct, but others are missing, even when they are the same displayed before. For example, the creator Jhon (id 4) appears in some Issues but not in other issues, that have the same creator:4 Using the Ember inspector in Chrome, those users are correctly loaded, so they are there. Issue model: import DS from

Switch from Ember Data FixtureAdapter to Ember Model FixtureAdapter

你。 提交于 2019-12-25 10:51:05
问题 After I learned that the BasicAdapter in Ember Data has been removed, I decided to switch from Ember Data to Ember Model because the API I work with is not totally RESTful (and I need more flexibility in general). I'm wondering how to "translate" some parts of my code that used to work with the FixtureAdapter from Ember Data. Here for example, I get a list of profiles but I want to directly redirect to the first one. That means, accessing /profiles will redirect me to something like /profiles