emberjs/data — pull request #2138 by opsb (2014-07-30 21:35:55+00:00)
Title: Follow rails conventions for serializing embedded objects

In https://github.com/emberjs/data/issues/1950 there was a lot of talk about how people expected the embedded objects to be serialized with _attributes when they're embedded (as per the rails convention). This PR will add _attributes to any embedded objects when the EmbeddedRecordsMixin is used.

It does break the existing behaviour but I think it's fair to say the existing behaviour is broken for rails. If someone does need the existing behaviour they can revert to the previous behaviour by overriding the formatEmbeddedKey method e.g.

App.ApplicationSerializer = DS.ActiveModelSerializer.extend(DS.EmbeddedRecordsMixin, {
formatEmbeddedKey: function(key){
return key;
},

attrs: {
video: { embedded: 'always' }
}
});