Ember JS - The 'model_name' alias has already been defined

My models are using each other and for the serialization to be successful I need to add aliases, but this causes an error: The '<model_name>' alias has already been defined.

My models:

// Directory model

App.Directory = DS.Model.extend({
  parent:     DS.belongsTo('App.Directory'),
  children:   DS.hasMany('App.Directory'),
  files:      DS.hasMany('App.File'),
})

DS.RESTAdapter.configure('App.Directory', {
  sideloadsAs: 'children'
});

DS.RESTAdapter.configure('plurals', {
  child: 'children'
}); 

// File model

App.File = DS.Model.extend({
  directory: DS.belongsTo('App.Directory')
});

As you see when I load a Directory (App.Directory.find(1)) I send in the response other directories because they are in a relationship, so my JSON looks like

{ "directories" : [ directories ], "files" : [ files ], "directory" : currentDirectory }

To make this work I’ve added:

DS.RESTAdapter.configure('App.Directory', {
  alias: 'directory'
});

BUT (here comes the problem), when I load a File (App.File.find(1)) object (the serialization includes some directories) so my JSON looks like:

{ "directories" : [ some directories ], "file" : currentFile }

I’ve get the error: The 'Directory' alias has already been defined

Update

As a workaround I could look for existing aliases, than if the alias is defined I would not add it. If someone got a tipp how to do that, please leave a comment!

Link to question on SO: http://stackoverflow.com/questions/18309674/ember-js-the-model-name-alias-has-already-been-defined