Comments (6)
Can you provide more details? Perhaps a JSBin showing what you're experiencing? What you describe should work just fine.
from ember-model.
It works when I reload the page, but it's not returning the value to the running app. Maybe I'm just not doing it properly, but I couldn't find any documentation on how it's meant to work. I'll try to get a JSBin up for you.
from ember-model.
Looks like I was indeed doing something wrong. I'm not sure what yet, but it's working in the example app (code here) I just created. Well … partially. It returns the tags (generated on the server) to the client, but not the id of the created object. The links to the just-created objects have ids of "undefined", despite being part of the JSON object returned from the POST request.
Hilariously, clicking between the links works even though there may be multiple objects have that "undefined" id. Unfortunately, those URLs don't work when you reload the page so if you share the "undefined" link with someone else or bookmark it, it won't be the right thing.
from ember-model.
@jgaskins I think you are missing id: Ember.attr()
in your Article model.
from ember-model.
That does make the id
work, however an explicit id
isn't necessary when you get the data from a GET
request, which seems inconsistent and adds to my confusion. :-)
Also, I added a belongsTo
to the Article
model in this sample app to simulate the server attaching the currently signed-in user to the article as the author (this is behavior I need in my real app). This doesn't seem to be handled in the running app until the page reloads even though the relationship is explicit in the model.
Something I'm wondering about, I'm using links.author
to specify the relationship in JSON, as mentioned on the json-api.org documentation, rather than the author_id
as mentioned in the Ember Model readme. Could the fact that it's contained within a nested document be part of the problem?
from ember-model.
Closing due to inactivity. Please reopen if this is still an issue.
from ember-model.
Related Issues (20)
- Ember-cli, declaring an association fails because the model's container is not defined
- Adding dynamic segment to model's urls HOT 1
- Array attr type seems to be broken HOT 4
- Ember-model compatible with Ember-1.11.1 HOT 3
- Compatibility with ember-data HOT 7
- Assertion Failed: You must use Ember.set() to set the `record` property HOT 1
- Compatibility with Ember ~1.13
- Bower doesn't have version 0.0.16 available? HOT 3
- Nested async relation is not fetched
- [Question]: what benefit do you get adding another queue to ember.run?
- hasMany properties do not interact correctly with computed array properties
- Does not work without prototype extensions
- ember-model and ember 2.9.1 HOT 1
- Ember.Model.Store `container` attribute triggers `Cannot read property '__container__' of undefined` on Ember 2.13 production builds HOT 2
- Update Ember Model for Ember 3.0 HOT 2
- Travis CI isn't displaying logs HOT 1
- Replace bower with npm for `ember-source`
- Upgrade node on travis
- Publish ember-model 2.18.0 HOT 1
- ES6 import syntax not working as expected
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-model.