     # will be called in the scope of the parent model
     createModel: (association, name, definition, fk, pk, target_class) ->
         target_class ||= association.getClassFor(name)
-        options = association.getOptions(name, definition, this)
+        options = association.getOptions(name, this)
         model_id = this.get(pk)
         if model_id && model_id == this._cache[name]?.id
             this._cache[name]

            new target_class(options)

    # returns a collection for the given association.
    collectionFor: (name) ->
        @collections[name] ||= (
            klass = @getClassFor(name)
            klass = klass.Collection if true == klass::isModel
            new klass
        )

    # set from collection
    getModelFromCollection: (model, name, collection) ->
        throw("#{name} isn't an association") unless _.has(@definitions, name)
        if not model[name].isNew()
            return model[name]
        else
            id = model[@pk(name)]
            model = collection.get(id)
            collection.fetchId(id) if id and not model
            model

    # will be called in the scope of the parent model
    createCollection: (association, name, definition, fk, pk, target_class) ->
        target_class ||= association.getClassFor(name)
        options = association.getOptions(name, definition, this)
        options.filter ||= {}
        options.filter[fk] = this.get(pk)


        options.saveDepth = ( if options.saveDepth then options.saveDepth + 1 else 1 )
        return ret if options.saveDepth > 5
        for name, options of @definitions
            continue if options.readOnly
            assoc = model[name]
            ret[name] = assoc.dataForSave(options) if _.result(assoc, 'isDirty')
        ret

    serialize: (model, options = {depth: 1}) ->
        ret = {}
        return ret if options.depth > 5
        for name, options of @definitions
            ret[name] = model[name].serialize()
        ret

    # return a list of assocations from "name" that are not loaded
