From a2fe1c0dcca78076020ada9deb01632ffc59af2b Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 14 Sep 2014 12:18:47 -0400 Subject: [PATCH] fix live updating --- app/routes/posts.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/routes/posts.js b/app/routes/posts.js index c689f4e6..4c45bb60 100644 --- a/app/routes/posts.js +++ b/app/routes/posts.js @@ -2,5 +2,16 @@ import Ember from "ember"; export default Ember.Route.extend({ model: function() { return this.get('store').find('post'); - } + }, + afterModel: function (recordArray) { + // This tells PouchDB to listen for live changes and + // notify Ember Data when a change comes in. + new PouchDB('bloggr').changes({ + since: 'now', + live: true + }).on('change', function () { + debugger; + recordArray.update(); + }); + } });