emberjs/data — pull request #76 by dmathieu (2012-02-02 13:55:44+00:00)
Title: add an alternative option in the hasOne association

This allows to change the null retrieved when the result of the association is not available.

DS.Model.extend({
tag: DS.hasOne(Tag, {alternative: function() { App.store.load(Tag, {})}})
});

This way, we can return a new record instead of a useless null when the association couldn't be found.

The alternative value can be a function, in which case it will be called and it's return value will be used.
Otherwise, it will just be used as it is (a string for example).