       debug "Loading #{Object.keys(cache).length} models..."
 
       Object.keys(cache).map (name) =>
-        @registerModel path.join @modelPaths[index], cache[name]
         debug 'Loading model:', name
+        @registerModels path.join @modelPaths[index], cache[name]
 
     .catch (err) =>
 

    return name


  registerModel: (path) ->

    cons = require path

    if cons.name? and ('function' is typeof cons)
      @defineModel cons.name, cons

    else
      models = []
      for own name, konstructor of cons
        models.push @defineModel name, konstructor

      models


  findCode = (paths) ->

      findCode([_path]).map (codePath) =>

        Promise.try =>
          models    = @registerModels codePath
          plainPath = codePath.replace _path, ''

          if models and models.length > 0
            debug models.join(', '), "model(s) found under:", plainPath
            cache[model] = plainPath  for model in models

          else
            debug 'No model found under:', plainPath

        .catch (err) =>
          @emit 'error', \
