From 08295f01aa4738e8981750964739f48d2e064133 Mon Sep 17 00:00:00 2001 From: magnolia-fan Date: Wed, 29 Jun 2011 04:25:36 +0400 Subject: [PATCH] Fixed session param bug --- app/coffeescripts/session.coffee | 4 ++-- public/javascripts/coffee/session.js | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/coffeescripts/session.coffee b/app/coffeescripts/session.coffee index 1642f80..84d6003 100644 --- a/app/coffeescripts/session.coffee +++ b/app/coffeescripts/session.coffee @@ -20,7 +20,7 @@ class Session query: (url, params, callback) -> q_params = @vk_params - for attr in params - q_params[attr] = params[attr] + $.each params, (key, val) -> + q_params[key] = val $.post url, q_params, callback false diff --git a/public/javascripts/coffee/session.js b/public/javascripts/coffee/session.js index 2d3a5ce..ffe5513 100644 --- a/public/javascripts/coffee/session.js +++ b/public/javascripts/coffee/session.js @@ -22,12 +22,11 @@ Session = (function() { return this.user; }; Session.prototype.query = function(url, params, callback) { - var attr, q_params, _i, _len; + var q_params; q_params = this.vk_params; - for (_i = 0, _len = params.length; _i < _len; _i++) { - attr = params[_i]; - q_params[attr] = params[attr]; - } + $.each(params, function(key, val) { + return q_params[key] = val; + }); $.post(url, q_params, callback); return false; };