         relation = @relations[key] = new HasMany(@model_type, key, options.slice(1))
       else
         throw new Error "Unrecognized relationship: #{util.inspect(options)}"
-      @relations[relation.ids_accessor] = relation if relation.ids_accessor
+      @relations_ids[relation.ids_accessor] = relation if relation.ids_accessor
 
   _parse: ->
     schema = _.result(@model_type, 'schema') or {}

    @model_type::get = (key, callback) ->
      console.log "key: #{key}"

      if relation = _schema.relations[key]
        return relation.get(@, key, callback)
      else
        value = _get.call(@, key)

      (attributes[attributes] = value; options = value) if _.isString(attributes)

      for key, value of attributes
        if relation = _schema.relations[key] or relation = _schema.relations_ids[key]
          relation.set(@, key, value, options, _set)
        else
          _set.call(@, key, value, options)
