       json[typeAttribute] = this.stringForType(record.constructor)
 
   addHasMany: (data, record, key, relationship) ->
+    @_addHasMany(data, record, key, relationship)
+
+  _addHasMany: (data, record, key, relationship) ->
     value = record.get(key)
-    attr_key = record.get("users_key") || "id"
+    attr_key = record.get("#{relationship.key}_key") || "id"
     if this.get('addEmptyHasMany') || !Ember.isEmpty(value)
       data[key] = value.getEach(attr_key)
 
   addBelongsTo: (hash, record, key, relationship) ->
-    id = get(record, relationship.key + '.id')
+    id_key = record.get("#{relationship.key}_key") || "id"
+    id = Ember.get(record, "#{relationship.key}.#{id_key}")
     hash[key] = id if this.get('addEmptyBelongsTo') || !Ember.isEmpty(id)
-
 
 DS.CouchDBAdapter = DS.Adapter.extend
   typeAttribute: 'ember_type'

    hash._id || hash.id

  stringForType: (type) ->
    type.toString()

  getRecordRevision: (record) ->
    record.get('_data.attributes._rev')

  serializer: DS.CouchDBSerializer

  _ajax: (url, type, hash) ->
    if url.split("/").pop() == "" then url = url.substr(0, url.length - 1)
    hash.url = url
    hash.type = type
    hash.dataType = 'json'
