forked from TryGhost/Admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added hacky method for accessing
meta
value of single-record requests
no issue - Ember Data does not support accessing meta data included in the response to single-record requests such as save/delete - approach to allow it taken from emberjs/data#4077 (comment)
- Loading branch information
1 parent
71c0cd1
commit 13d529c
Showing
3 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Model from 'ember-data/model'; | ||
|
||
export default Model.extend({ | ||
// this is a hack that gives us access to meta data in single resource responses | ||
// allows similar response.get('_meta') as with multi-resource responses but can | ||
// suffer from race conditions | ||
// TODO: review once the record links and meta RFC lands | ||
// https://github.com/emberjs/rfcs/blob/master/text/0332-ember-data-record-links-and-meta.md | ||
get _meta() { | ||
return this._internalModel.type.___meta; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters