Last active
August 29, 2015 14:24
-
-
Save knownasilya/2a5287a0de8caf064da3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error: Assertion Failed: Ember Data expected a number or string to represent the record(s) in the `role` relationship instead it found an object. If this is a polymorphic relationship please specify a `type` key. If this is an embedded relationship please include the `DS.EmbeddedRecordsMixin` and specify the `role` property in your serializer's attrs object. | |
at new Error (native) | |
at Error.EmberError (http://maldenma.localhost:3000/dashboard/assets/vendor.js:22059:21) | |
at Object.Ember.default.assert (http://maldenma.localhost:3000/dashboard/assets/vendor.js:15394:13) | |
at ember$data$lib$system$store$$deserializeRecordId (http://maldenma.localhost:3000/dashboard/assets/vendor.js:76334:15) | |
at http://maldenma.localhost:3000/dashboard/assets/vendor.js:76312:11 | |
at http://maldenma.localhost:3000/dashboard/assets/vendor.js:78222:20 | |
at Map.forEach.cb (http://maldenma.localhost:3000/dashboard/assets/vendor.js:23605:11) | |
at OrderedSet.forEach (http://maldenma.localhost:3000/dashboard/assets/vendor.js:23398:11) | |
at Map.forEach (http://maldenma.localhost:3000/dashboard/assets/vendor.js:23609:18) | |
at Function.ember$data$lib$system$model$$default.reopenClass.eachRelationship (http://maldenma.localhost:3000/dashboard/assets/vendor.js:78221:83) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import DS from 'ember-data'; | |
const computed = Ember.computed; | |
const attr = DS.attr; | |
const belongsTo = DS.belongsTo; | |
export default DS.Model.extend({ | |
name: attr('string'), | |
email: attr('string'), | |
status: attr('string'), | |
superuser: attr('boolean'), | |
role: belongsTo('role', { | |
async: true | |
}), | |
isActivated: computed.equal('status', 'activated'), | |
isRequested: computed.equal('status', 'requested'), | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, { | |
attrs: { | |
role: { | |
serialize: 'id', | |
deserialize: 'records' | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment