From 8cdd206f11dfb6ce8ed6727121b71b7ee04e2a56 Mon Sep 17 00:00:00 2001 From: Ryan Mark Date: Wed, 16 May 2018 19:13:33 -0700 Subject: [PATCH] init draft --- .../2018-05-18-the-emberjs-times-issue-47.md | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/source/blog/2018-05-18-the-emberjs-times-issue-47.md b/source/blog/2018-05-18-the-emberjs-times-issue-47.md index d12b7a9263..aa674e9f37 100644 --- a/source/blog/2018-05-18-the-emberjs-times-issue-47.md +++ b/source/blog/2018-05-18-the-emberjs-times-issue-47.md @@ -16,12 +16,26 @@ Again you can enjoy reading the Ember.js Times in both the [e-mail](https://the- ## [EMBER THINGS 🐹](#your-url-here) ---- - -## [EMBER DATA THINGS](#your-url-here) -- new RFC here: https://github.com/emberjs/rfcs/pull/332 +--- +## [Meta and Link all the Things](#https://github.com/emberjs/rfcs/pull/332) + +This backwards compatible RFC allows `ember-data` users to associate optional `meta` and `links` on records alongside the top-level document `meta` (mandatory) and `links` (optional). Sadly, `ember-data` currently stores this information only on relationships and not individual records. The RFC design is pretty straightforward, designate that all `meta` and `links` : + - will be honored in any resource encountered in a json-api compliant document + - when defined on resource identifiers, for example links to resources within a relationship, will be ignored. + - when defined on relationship objects will continue to function as they do today. + - will be exposed as getters on instances of `DS.Model` and will default to null if nothing has been provided. +Similarly, `meta` and `links` will be exposed on instances of `DS.Snapshot`. Although `meta` and `links` are getters on `DS.Model`s, they will be exposed on `DS.Snapshot` as methods: +```js +class Snapshot { + links() {} + meta() {} +} +``` +Interestingly, some apps have inadvertently achieved what this RFC purposes by moving `meta` and `links` into `attributes` during serialization and then exposing each of them via `DS.attr`., Therefore, this RFC gives `ember-data` an even more complete "out of the box experience" and will likely be a very welcomed addition to the library. + +Think differently? Tell @runspired what you think at https://github.com/emberjs/rfcs/pull/332 ---