-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Fix bug with model fragments support #185
Conversation
@@ -39,7 +39,8 @@ export default class { | |||
if ('function' === typeof serializer.transformFor) { | |||
// Use serializer.transformFor for compatibility with ember-data-model-fragments, | |||
// for context see https://github.com/danielspaniel/ember-data-factory-guy/issues/182 | |||
return serializer.transformFor(type).serialize; | |||
let fragmentType = serializer.transformFor(type); | |||
return fragmentType.deserialize.bind(fragmentType); |
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.
Should this be return fragmentType.serialize.bind(fragmentType);
?
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.
Actually I am wondering if this should be a do nothing ( return (x)=>x ) kind of thing.
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.
Should this be return fragmentType.serialize.bind(fragmentType);?
Tried that and got "Cannot read property 'modelName' of undefined" on the last line of this snippet.
/**
Changes serializer fallbacks for fragments to use `serializer:-fragment`
if registered, then uses the default serializer.
@method serializerFor
@private
@param {String} modelName the record to serialize
@return {DS.Serializer}
*/
serializerFor: function serializerFor(modelOrClass) {
var modelName;
if (typeof modelOrClass === 'string') {
modelName = modelOrClass;
} else {
modelName = modelOrClass.modelName;
}
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.
Interestingly, if I just return this.noTransformFn, all my tests pass in the sample repo.
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.
Right, that is what I was saying about the (x)=> x .. function = noTransformFn.
I think that is the correct answer .. but I want to get more tests in there and if you can help with that .. then rock on.
Need to know more about MF transformations and when they are used.
This issue should now be fixed with version 2.5 ( which has full support for ember-data-model-fragments ) |
See: #184 (comment)