Last active
December 16, 2015 08:39
-
-
Save thomasboyt/5407793 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Defines a live, embedded hasMany relationship that updates automatically | |
// models | |
App.ChatRoom = DS.Firebase.LiveModel.extend({ | |
title: DS.attr("text"), | |
messages: DS.hasMany("App.Message", {live: true}) | |
}); | |
App.Message = DS.Firebase.LiveModel.extend({ | |
text: DS.attr("text"), | |
username: DS.attr("text"), | |
chatRoom: DS.belongsTo("App.ChatRoom") | |
}); | |
// adapter options mapping | |
DS.Firebase.Adapter.map("App.ChatRoom", { | |
messages: {embedded: 'always'}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment