From 67922e7a26f87076b2b270c11444db68e7820c3b Mon Sep 17 00:00:00 2001 From: bradwbradw Date: Wed, 19 Feb 2014 13:48:16 -0800 Subject: [PATCH] Update book_rest.js the code at line 111 causes the BASE_URL to persist even if different models (with different base urls) use the same sync adapter, so i added code in the sync method to override BASE_URL with the adapter's config.base_url. --- app/lib/alloy/sync/book_rest.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/lib/alloy/sync/book_rest.js b/app/lib/alloy/sync/book_rest.js index e20982f..a305814 100644 --- a/app/lib/alloy/sync/book_rest.js +++ b/app/lib/alloy/sync/book_rest.js @@ -8,7 +8,11 @@ module.exports.sync = function(method, model, options) { var payload = model.toJSON(); var error; - + + if(typeof(model.config.adapter.base_url) != 'undefined'){ + BASE_URL = model.config.adapter.base_url; + // this enables other models using the same adapter to work, otherwise the BASE_URL variable persists + } switch(method) { // This case is called by the Model.fetch and Collection.fetch methods to retrieve data. @@ -115,4 +119,4 @@ module.exports.beforeModelCreate = function(config, name) { // Perform some actions after creating the Model class module.exports.afterModelCreate = function(Model, name) { // Nothing to do -}; \ No newline at end of file +};