       @
 
     _getURLBase: ->
-      "#{@constructor.urlPrefix}#{@constructor.urlEndpoint}"
+      _urljoin @constructor.urlPrefix, @constructor.urlEndpoint
 
     _fetchRelations: ->
       @_fetchReferences()

      data = @_toObject()
      if @$meta.persisted and @$id?
        method = 'PUT'
        url = @_getURLBase() + "#{@$id}"
      else
        method = 'POST'
        if @constructor.idField of data
          delete data[@constructor.idField]
        url = @_getURLBase()

      # TODO: check deferred/promise re-setup
      @_setupPromises()


    @Get: (id) ->
      item = new @()
      url = urljoin @_GetURLBase(), id
      $http(
        method: "GET"
        url: url
