Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ember CLI 3.0 upgrade #16

Open
wants to merge 6 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Fix all of the new errors after the upgrade

  • Loading branch information
CrshOverride committed Mar 15, 2018
commit e6b8836ab53a5f8819e37775169182d7b59a64b9
@@ -1,5 +1,5 @@
import Ember from 'ember';
import DS from 'ember-data';
import { camelize } from '@ember/string';

const VALIDATION_ERROR_STATUSES = [400, 422];

@@ -25,7 +25,7 @@ export default DS.RESTAdapter.extend({

if (jsonIsObject && json.modelState) {
Object.keys(json.modelState).forEach(key => {
let newKey = Ember.String.camelize(key.substring(key.indexOf('.') + 1));
let newKey = camelize(key.substring(key.indexOf('.') + 1));
strippedErrors[newKey] = json.modelState[key];
});

@@ -1,5 +1,7 @@
import Ember from 'ember';
import DS from 'ember-data';
import { A } from '@ember/array';
import { copy } from '@ember/object/internals';

export default DS.RESTSerializer.extend({
isNewSerializerAPI: true,
@@ -19,15 +21,15 @@ export default DS.RESTSerializer.extend({
if(isCollection) {
payload.forEach((item) => {
this._extractRelationships(store, payloadWithRoot, item, primaryModelClass);
item.attributes = Ember.copy(item, true);
item.attributes = copy(item, true);
if(item.type) {
item.type = primaryModelClass.modelName;
}
delete item.attributes.id;
});
} else {
this._extractRelationships(store, payloadWithRoot, payload, primaryModelClass);
payload.attributes = Ember.copy(payload, true);
payload.attributes = copy(payload, true);
if(payload.type) {
payload.type = primaryModelClass.modelName;
}
@@ -71,15 +73,15 @@ export default DS.RESTSerializer.extend({
}

let key = Ember.Inflector.inflector.pluralize(type.modelName),
arr = payload[key] || Ember.A([]),
arr = payload[key] || A([]),
pk = store.serializerFor(type.modelName).primaryKey,
id = record[pk];

if(typeof arr.findBy(pk, id) !== 'undefined') {
return true;
}

record.attributes = Ember.copy(record, true);
record.attributes = copy(record, true);
record.type = type.modelName;
delete record.attributes.id;

@@ -33,7 +33,6 @@
"broccoli-asset-rev": "^2.4.5",
"ember-ajax": "^3.0.0",
"ember-cli": "~3.0.0",
"ember-cli-blanket": "0.6.2",
"ember-cli-dependency-checker": "^2.0.0",
"ember-cli-eslint": "^4.2.1",
"ember-cli-htmlbars": "^2.0.1",
@@ -18,19 +18,6 @@
{{content-for "test-head-footer"}}
</head>
<body>
<<<<<<< HEAD

{{content-for 'body'}}
{{content-for 'test-body'}}
<script src="assets/vendor.js"></script>
<script src="assets/test-support.js"></script>
<script src="assets/dummy.js"></script>
<script src="assets/blanket-options.js"></script>
<script src="assets/blanket-loader.js"></script>
<script src="testem.js"></script>
<script src="assets/test-loader.js"></script>
<script src="assets/tests.js"></script>
=======
{{content-for "body"}}
{{content-for "test-body"}}

@@ -39,7 +26,6 @@
<script src="{{rootURL}}assets/test-support.js"></script>
<script src="{{rootURL}}assets/dummy.js"></script>
<script src="{{rootURL}}assets/tests.js"></script>
>>>>>>> 1206dc0... message

{{content-for "body-footer"}}
{{content-for "test-body-footer"}}
@@ -1,5 +1,5 @@
import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
import { A } from '@ember/array';

moduleFor('serializer:web-api', 'Unit | Serializer | web api', {
// Specify the other units that are required for this test.
@@ -87,7 +87,7 @@ test('it parses a basic hasMany relationship', function(assert) {
id: 1,
name: 'Luke Skywalker',
isJedi: true,
droids: Ember.A([
droids: A([
{ id: 1, type: 'protocol', model: 'C3PO' },
{ id: 2, type: 'astromech', model: 'R2D2' }
])
@@ -132,8 +132,6 @@ test('it parses a basic hasMany relationship', function(assert) {
}]
};

console.log(parsed);

assert.deepEqual(parsed, expected);
});

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.