From 56a519c5838067d2f0387880a1edb055516cd91e Mon Sep 17 00:00:00 2001
From: Wojciech Zawistowski <wojciech.zawistowski@gmail.com>
Date: Wed, 9 Oct 2013 18:00:55 +0200
Subject: [PATCH] refactors Discourse.Model to bind context to self plus some
 minor clean-ups

---
 app/assets/javascripts/discourse/models/model.js | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/app/assets/javascripts/discourse/models/model.js b/app/assets/javascripts/discourse/models/model.js
index 44470e23d..ea1bcfb18 100644
--- a/app/assets/javascripts/discourse/models/model.js
+++ b/app/assets/javascripts/discourse/models/model.js
@@ -16,12 +16,11 @@ Discourse.Model = Ember.Object.extend(Discourse.Presence, {
     @param {Object} attrs The attributes we want to merge with
   **/
   mergeAttributes: function(attrs) {
-    var _this = this;
-    _.each(attrs, function(v,k) {
-      _this.set(k, v);
+    var self = this;
+    _.each(attrs, function(v, k) {
+      self.set(k, v);
     });
   }
-
 });
 
 Discourse.Model.reopenClass({
@@ -31,16 +30,13 @@ Discourse.Model.reopenClass({
 
     @method extractByKey
     @param {Object} collection The collection of values
-    @param {Object} klass Optional The class to instantiate
+    @param {Object} klass The class to instantiate
   **/
   extractByKey: function(collection, klass) {
     var retval = {};
-    if (!collection) return retval;
-    _.each(collection,function(c) {
-      retval[c.id] = klass.create(c);
+    _.each(collection, function(item) {
+      retval[item.id] = klass.create(item);
     });
     return retval;
   }
 });
-
-