Skip to content

Instantly share code, notes, and snippets.

@ericf
Created May 6, 2013 03:38
Show Gist options
  • Save ericf/5523231 to your computer and use it in GitHub Desktop.
Save ericf/5523231 to your computer and use it in GitHub Desktop.
Y.Guest = Y.Base.create('guest', Y.Model, [Y.ModelSync.REST], {
root: '/guests/'
});
Y.Guests = Y.Base.create('guests', Y.ModelList, [Y.ModelSync.REST], {
model: Y.Guest
});
Y.Invitation = Y.Base.create('invitation', Y.Model, [Y.ModelSync.REST], {
root: '/invitations/',
initializer: function () {
this.guests = new Y.Guests({bubbleTargets: this});
},
_setGuests: function (guests) {
return this.guests.reset(guests);
}
}, {
ATTRS: {
guests: {setter: '_setGuests'}
}
});
@olanb7
Copy link

olanb7 commented May 6, 2013

Nice. I'm doing something pretty much exactly like this.. but far more awkwardly! This would be a nice addition to the YUI3 examples imo.

@ericf
Copy link
Author

ericf commented May 6, 2013

@olanb7 are you talking about the model contains a model list part?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment