`mask` attribute ignored on related models
If a resource has a defined relation with another resource, then setting a mask attribute doesn't work. For example:
angular.module('mapping')
.factory('UserResource', function (restmod) {
return restmod.model('/api/users').mix({
'Profile':{
belongsTo: 'ProfileResource',
mask: 'CU'
},
'Posts':{
belongsToMany: 'PostResource',
mask: 'CU'
}
});
})
.factory('ProfileResource', function (restmod) {
return restmod.model('/api/profile');
})
.factory('PostResource', function (restmod) {
return restmod.model('/api/users');
});
Using the above code, if you get a user using var user = UserResource.$find(1), and then save it using user.$save(), the actual request has profile_id, and post_ids attributes sent, ignoring the U flags.
I ran into this same problem. Turns out, https://github.com/platanus/angular-restmod/commit/764b562e3a90617e11ab0558b49aa2e7ef562005 broke this functionality because the relation attribute mapping will now happen after your mask mapping. Since the relationship mapping explicitly sets the mask on your relation, it overwrites your mask. For now version 1.9 still functions correctly with the old behavior
You can separate it out in 2 mixins one with the masks and other with the relations as a work around?