From 0ab0d2450724ba7dbc136e645330634df536193a Mon Sep 17 00:00:00 2001 From: Diogo Resende Date: Fri, 15 Mar 2013 11:11:48 +0000 Subject: [PATCH] Changes Model to pass instance.cacheSaveCheck setting to Singleton (#78) --- lib/Model.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/Model.js b/lib/Model.js index 5a15e05e..bac0a3fe 100644 --- a/lib/Model.js +++ b/lib/Model.js @@ -150,7 +150,10 @@ function Model(opts) { if (data.length === 0) { return cb(new Error("Not found")); } - Singleton.get(opts.table + "/" + id, { cache: options.cache }, function (cb) { + Singleton.get(opts.table + "/" + id, { + cache : options.cache, + save_check : opts.settings.get("instance.cacheSaveCheck") + }, function (cb) { return createInstance(data[0], { autoSave : opts.autoSave, autoFetch : (options.autoFetchLimit === 0 ? false : opts.autoFetch), @@ -223,9 +226,10 @@ function Model(opts) { merge : merge, offset : options.offset, newInstance: function (data, cb) { - Singleton.get(opts.table + (merge ? "+" + merge.from.table : "") + "/" + data[opts.id], - { cache: options.cache }, - function (cb) { + Singleton.get(opts.table + (merge ? "+" + merge.from.table : "") + "/" + data[opts.id], { + cache : options.cache, + save_check : opts.settings.get("instance.cacheSaveCheck") + }, function (cb) { return createInstance(data, { autoSave : opts.autoSave, autoFetch : (options.autoFetchLimit === 0 ? false : opts.autoFetch),