diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 16d65af..4580220 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,7 @@ This is an Ember app, so the usual steps follow: ``` 1. Run the app. ```bash - ember serve + npm run start ``` 1. Visit your app at [http://localhost:4200](http://localhost:4200). diff --git a/snippets/updating-data/create-record/handler.js b/snippets/updating-data/create-record/handler.js index 7e5e0f6..56baa52 100644 --- a/snippets/updating-data/create-record/handler.js +++ b/snippets/updating-data/create-record/handler.js @@ -18,10 +18,11 @@ const updatesHandler = { const { data, store } = context.request; const newRequestParams = Object.assign({}, context.request, { - body: serializeResources( - store.cache, - recordIdentifierFor(data.record) - ) + body: JSON.stringify( + serializeResources( + store.cache, + data.record + )) }); return next(newRequestParams); } diff --git a/snippets/updating-data/save-record/handler.js b/snippets/updating-data/save-record/handler.js index 125b343..1a90e29 100644 --- a/snippets/updating-data/save-record/handler.js +++ b/snippets/updating-data/save-record/handler.js @@ -1,5 +1,4 @@ // Create handler for serialization of any record -import { recordIdentifierFor } from '@ember-data/store'; import { serializeResources } from '@ember-data/json-api/request'; const updatesHandler = { @@ -18,10 +17,10 @@ const updatesHandler = { const { data, store } = context.request; const newRequestParams = Object.assign({}, context.request, { - body: serializeResources( + body: JSON.stringify(serializeResources( store.cache, - recordIdentifierFor(data.record) - ) + data.record + )) }); return next(newRequestParams); } diff --git a/tests/integration/components/guide-section/subsection-test.js b/tests/integration/components/guide-section/subsection-test.js index 997e0e9..6c29c16 100644 --- a/tests/integration/components/guide-section/subsection-test.js +++ b/tests/integration/components/guide-section/subsection-test.js @@ -97,7 +97,7 @@ module('Integration | Component | guide-section/subsection', function (hooks) { assert .dom('[data-test-field="Subsection Description"]') .includesText( - '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.' + '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.' ); const emberClassic = this.element.querySelector( diff --git a/translations/updating-data/create-record/en-us.yaml b/translations/updating-data/create-record/en-us.yaml index c03e200..1efc5d3 100644 --- a/translations/updating-data/create-record/en-us.yaml +++ b/translations/updating-data/create-record/en-us.yaml @@ -1,2 +1,2 @@ title: createRecord -description: 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. +description: 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.