-
Notifications
You must be signed in to change notification settings - Fork 50
Update to ember data 1.0.0 beta.19 #99
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
base: master
Are you sure you want to change the base?
Changes from all commits
88f908a
5d04e4f
0fdd8c4
c11a645
9439137
023899a
b15b7c6
0e5d29f
138f7fe
2d1283a
c1ec9f6
0807f78
43990ce
f8c2484
1afda46
c6aec48
8e21e83
3823422
dbac273
de16194
a191d64
332c6a7
eb99a8d
bfce122
6b28a04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "ignore_dirs": ["tmp"] | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ export default DS.RESTSerializer.extend({ | |
| return this._super( store, primaryType, namespacedPayload, recordId ); | ||
| }, | ||
|
|
||
| typeForRoot: function( key ) { | ||
| modelNameFromPayloadKey: function( key ) { | ||
| return Ember.String.dasherize( Ember.String.singularize( key ) ); | ||
| }, | ||
|
|
||
|
|
@@ -86,7 +86,7 @@ export default DS.RESTSerializer.extend({ | |
| // the links property so the adapter can async call the | ||
| // relationship. | ||
| // The adapter findHasMany has been overridden to make use of this. | ||
| if(options.relation) { | ||
| //if(options.relation) { | ||
| // hash[key] contains the response of Parse.com: eg {__type: Relation, className: MyParseClassName} | ||
| // this is an object that make ember-data fail, as it expects nothing or an array ids that represent the records | ||
| hash[key] = []; | ||
|
|
@@ -97,8 +97,8 @@ export default DS.RESTSerializer.extend({ | |
| hash.links = {}; | ||
| } | ||
|
|
||
| hash.links[key] = JSON.stringify({typeKey: relationship.type.typeKey, key: key}); | ||
| } | ||
| hash.links[key] = JSON.stringify({typeKey: relationship.type, key: key}); | ||
| //} | ||
|
|
||
| if ( options.array ) { | ||
| // Parse will return [null] for empty relationships | ||
|
|
@@ -148,25 +148,24 @@ export default DS.RESTSerializer.extend({ | |
| } | ||
| }, | ||
|
|
||
| serializeBelongsTo: function( snapshot, json, relationship ) { | ||
| serializeBelongsTo: function(snapshot, json, relationship) { | ||
| var key = relationship.key, | ||
| belongsToId = snapshot.belongsTo(key, { id: true }); | ||
|
|
||
| if ( belongsToId ) { | ||
| if (belongsToId) { | ||
| json[key] = { | ||
| '__type' : 'Pointer', | ||
| 'className' : this.parseClassName(key), | ||
| 'className' : this.parseClassName(relationship.type), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Above
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah that needs to be updated. |
||
| 'objectId' : belongsToId | ||
| }; | ||
| } | ||
| }, | ||
|
|
||
| parseClassName: function( key ) { | ||
| if ( 'parseUser' === key) { | ||
| parseClassName: function(key) { | ||
| if ('parseUser' === key) { | ||
| return '_User'; | ||
|
|
||
| } else { | ||
| return Ember.String.capitalize( Ember.String.camelize( key ) ); | ||
| return Ember.String.capitalize(Ember.String.camelize(key)); | ||
| } | ||
| }, | ||
|
|
||
|
|
@@ -179,19 +178,23 @@ export default DS.RESTSerializer.extend({ | |
| if ( hasMany && hasMany.get( 'length' ) > 0 ) { | ||
| json[key] = { 'objects': [] }; | ||
|
|
||
| if ( options.relation ) { | ||
| // an array is not a relationship, right? | ||
|
|
||
| /*if ( options.relation ) { | ||
| json[key].__op = 'AddRelation'; | ||
| } | ||
|
|
||
| if ( options.array ) { | ||
| json[key].__op = 'AddUnique'; | ||
| } | ||
| }*/ | ||
|
|
||
| json[key].__op = 'AddRelation'; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure where |
||
|
|
||
| hasMany.forEach( function( child ) { | ||
| json[key].objects.push({ | ||
| '__type' : 'Pointer', | ||
| 'className' : _this.parseClassName(child.type.typeKey), | ||
| 'objectId' : child.attr( 'id' ) | ||
| 'objectId' : child.id | ||
| }); | ||
| }); | ||
|
|
||
|
|
@@ -225,8 +228,8 @@ export default DS.RESTSerializer.extend({ | |
| } | ||
|
|
||
| } else { | ||
| json[key] = []; | ||
| json[key] = null; | ||
| } | ||
| } | ||
|
|
||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| module.exports = { | ||
| scenarios: [ | ||
| { | ||
| name: 'default', | ||
| dependencies: { } | ||
| }, | ||
| { | ||
| name: 'ember-release', | ||
| dependencies: { | ||
| 'ember': 'components/ember#release' | ||
| }, | ||
| resolutions: { | ||
| 'ember': 'release' | ||
| } | ||
| }, | ||
| { | ||
| name: 'ember-beta', | ||
| dependencies: { | ||
| 'ember': 'components/ember#beta' | ||
| }, | ||
| resolutions: { | ||
| 'ember': 'beta' | ||
| } | ||
| }, | ||
| { | ||
| name: 'ember-canary', | ||
| dependencies: { | ||
| 'ember': 'components/ember#canary' | ||
| }, | ||
| resolutions: { | ||
| 'ember': 'canary' | ||
| } | ||
| } | ||
| ] | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* global require, module */ | ||
| var EmberApp = require('ember-cli/lib/broccoli/ember-addon'); | ||
|
|
||
| module.exports = function(defaults) { | ||
| var app = new EmberApp(defaults, { | ||
| // Add options here | ||
| }); | ||
|
|
||
| /* | ||
| This build file specifes the options for the dummy test app of this | ||
| addon, located in `/tests/dummy` | ||
| This build file does *not* influence how the addon or the app using it | ||
| behave. You most likely want to be modifying `./index.js` or app's build file | ||
| */ | ||
|
|
||
| return app.toTree(); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recall what was happening here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Release notes said that the typeForRoot function had been changed to modelNameFromPayloadKey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just meant
options.relationshipvsoptions.array. I recall now, they are two different options for how to persist a relationship. One with an array of ids, one with w URL.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my bad. See my comment below about that. Not sure what should be happening with those two options.