Skip to content

Instantly share code, notes, and snippets.

@thomasboyt
Last active December 16, 2015 08:39
Show Gist options
  • Save thomasboyt/5407793 to your computer and use it in GitHub Desktop.
Save thomasboyt/5407793 to your computer and use it in GitHub Desktop.
// 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