I have the next resource:
angular.module('app').factory 'User', [
'$resource'
($resource) ->
$resource '/users/:id/:action', {
id: '@id'
action: '@action'
},
query:
method: 'GET'
isArray: false
'update':
method: 'PUT'
transformRequest: (data) ->
JSON.stringify user: data
'resetPassword':
params: action: 'reset_password'
method: 'PUT'
]
And I want to unify it with the next one:
angular.module('app').factory "NewUser", ["RailsResource", "railsSerializer", (RailsResource, railsSerializer) ->
class NewUser extends RailsResource
@configure
url: '/users'
rootWrapping: false
serializer: railsSerializer ->
@nestedAttribute "addresses", "address"
NewUser
]
The goal is to have both of the above resources merged into a single one. What's the best approach for doing this?