property type array is not used anymore
This commit is contained in:
parent
e7adabe78a
commit
d56176dfb2
1 changed files with 1 additions and 36 deletions
|
@ -89,41 +89,6 @@ Ember.computed.encrypted = function(encryptedField, dataType) {
|
|||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* array as attribute for models
|
||||
*/
|
||||
App.ArrayTransform = DS.Transform.extend({
|
||||
// If the outgoing json is already a valid javascript array
|
||||
// then pass it through untouched. In all other cases, replace it
|
||||
// with an empty array. This means null or undefined values
|
||||
// automatically become empty arrays when serializing this type.
|
||||
serialize: function (jsonData) {
|
||||
if (Em.typeOf(jsonData) === 'array') {
|
||||
return jsonData;
|
||||
}
|
||||
else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
// If the incoming data is a javascript array, pass it through.
|
||||
// If it is a string, then coerce it into an array by splitting
|
||||
// it on commas and trimming whitespace on each element.
|
||||
// Otherwise pass back an empty array. This has the effect of
|
||||
// turning all other data types (including nulls and undefined
|
||||
// values) into empty arrays.
|
||||
deserialize: function (externalData) {
|
||||
switch (Em.typeOf(externalData)) {
|
||||
case 'array':
|
||||
return externalData;
|
||||
case 'string':
|
||||
return externalData.split(',').map( function(item) { return jQuery.trim(item) } );
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
/*
|
||||
* models
|
||||
*/
|
||||
|
@ -140,7 +105,7 @@ App.Poll = DS.Model.extend({
|
|||
answerType : Ember.computed.encrypted('encryptedAnswerType', 'string'),
|
||||
encryptedAnswers : DS.attr('string'),
|
||||
answers : Ember.computed.encrypted('encryptedAnswers', 'array'),
|
||||
encryptedOptions : DS.attr('string'),
|
||||
encryptedOptions : DS.attr('string'),
|
||||
options : Ember.computed.encrypted('encryptedOptions', 'array'),
|
||||
users : DS.hasMany('user', {async: true}),
|
||||
encryptedCreationDate : DS.attr('string'),
|
||||
|
|
Loading…
Reference in a new issue