2014-10-30 21:44:22 +01:00
|
|
|
import DS from "ember-data";
|
2015-08-19 22:00:01 +02:00
|
|
|
import ApplicationAdapter from './application';
|
2015-10-25 16:46:11 +01:00
|
|
|
import Ember from "ember";
|
2014-10-30 21:44:22 +01:00
|
|
|
|
2015-08-19 22:00:01 +02:00
|
|
|
export default ApplicationAdapter.extend(DS.EmbeddedRecordsMixin, {
|
2014-09-28 14:55:40 +02:00
|
|
|
attrs: {
|
2015-01-20 22:47:04 +01:00
|
|
|
users: {
|
|
|
|
deserialize: 'records'
|
|
|
|
}
|
2015-10-25 16:46:11 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
legacySupport(resourceHash) {
|
|
|
|
// croodle <= 0.3.0
|
|
|
|
// property "type" of answers was named "id"
|
|
|
|
if (
|
|
|
|
resourceHash.answers.length > 0 &&
|
|
|
|
!Ember.isEmpty(resourceHash.answers[0].id)
|
|
|
|
) {
|
|
|
|
resourceHash.answers.forEach((answer, index) => {
|
|
|
|
resourceHash.answers[index].type = answer.id;
|
|
|
|
delete resourceHash.answers[index].id;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return resourceHash;
|
2014-09-28 14:55:40 +02:00
|
|
|
}
|
2015-08-19 22:00:01 +02:00
|
|
|
});
|