Skip to content

Commit e5a6ff2

Browse files
authored
Merge pull request #18 from MehulKChaudhari/fix/documentaion-remove-recordIdentifierFor-create-record
fix: update docs to reflect correct record handling
2 parents 4f9572a + 597ad09 commit e5a6ff2

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This is an Ember app, so the usual steps follow:
2525
```
2626
1. Run the app.
2727
```bash
28-
ember serve
28+
npm run start
2929
```
3030
1. Visit your app at [http://localhost:4200](http://localhost:4200).
3131

snippets/updating-data/create-record/handler.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ const updatesHandler = {
1818

1919
const { data, store } = context.request;
2020
const newRequestParams = Object.assign({}, context.request, {
21-
body: serializeResources(
22-
store.cache,
23-
recordIdentifierFor(data.record)
24-
)
21+
body: JSON.stringify(
22+
serializeResources(
23+
store.cache,
24+
data.record
25+
))
2526
});
2627
return next(newRequestParams);
2728
}

snippets/updating-data/save-record/handler.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// Create handler for serialization of any record
2-
import { recordIdentifierFor } from '@ember-data/store';
32
import { serializeResources } from '@ember-data/json-api/request';
43

54
const updatesHandler = {
@@ -18,10 +17,10 @@ const updatesHandler = {
1817

1918
const { data, store } = context.request;
2019
const newRequestParams = Object.assign({}, context.request, {
21-
body: serializeResources(
20+
body: JSON.stringify(serializeResources(
2221
store.cache,
23-
recordIdentifierFor(data.record)
24-
)
22+
data.record
23+
))
2524
});
2625
return next(newRequestParams);
2726
}

tests/integration/components/guide-section/subsection-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ module('Integration | Component | guide-section/subsection', function (hooks) {
9797
assert
9898
.dom('[data-test-field="Subsection Description"]')
9999
.includesText(
100-
'To create a new record using Ember Data you should use createRecord request and attach "body" to it. In case of JSON:API backend - you can user serializeResources request utility.'
100+
'To create a new record using Ember Data you should use createRecord request and attach "body" to it. In case of JSON:API backend - you can use serializeResources request utility.'
101101
);
102102

103103
const emberClassic = this.element.querySelector(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
title: createRecord
2-
description: To create a new record using Ember Data you should use <code>createRecord</code> request and attach <code>"body"</code> to it. In case of JSON:API backend - you can user <code>serializeResources</code> request utility.
2+
description: To create a new record using Ember Data you should use <code>createRecord</code> request and attach <code>"body"</code> to it. In case of JSON:API backend - you can use <code>serializeResources</code> request utility.

0 commit comments

Comments
 (0)