createRecord with many-to-many relationship


How do I store.createRecord() with many-to-many relationships?

This is my Room model:

App.Room = DS.Model.extend({
  name         : DS.attr(),
  users: DS.hasMany('user',{async:true})

This is my User model:

App.User = DS.Model.extend({
  name         : DS.attr(),
  email        : DS.attr(),
  rooms: DS.hasMany('room',{async:true})

The User and the Room have a many-to-many relationship. When creating a record I use this:

var data =   {name: 'tbd', email: '', rooms: [] }
var record ='user', data);

However there is no relationship set.

(BTW I am using DS.RESTSerializer.)

Any ideas?