From a7a48cfa960b2757406bb4c6bfa8421733f7f2da Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 31 Oct 2013 23:35:58 +0100 Subject: [PATCH] Fixed Model.retrieve() --- .../app/models/_application_model.js.coffee | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/app/models/_application_model.js.coffee b/app/assets/javascripts/app/models/_application_model.js.coffee index 1459e27c3..782c9320b 100644 --- a/app/assets/javascripts/app/models/_application_model.js.coffee +++ b/app/assets/javascripts/app/models/_application_model.js.coffee @@ -114,13 +114,11 @@ class App.Model extends Spine.Model if callback # execute callback if record got loaded - col = @ - App[ @className ].one 'refresh', (record) -> - delay = => - data = App[ @className ].find( id ) - if callback + App[ @className ].one 'refresh', (records) -> + for record in records + if record.id.toString() is id.toString() + data = App[ @className ].find( record.id ) callback( data ) - window.setTimeout(delay, 200) # fetch object console.log 'debug', 'loading..' + @className + '..', id