title: How to update attribute of an existing model?
body: <p>I wanted to update the <strong>rank</strong> attribute of an existing model which I passed from another view. However, I get the error <strong>Uncaught TypeError: Object # has no method 'set'</strong>. </p>
  
  <p>In the initialize part of the view, I have :</p>
  
  <pre><code>this.collection = new tgcollection({model : this.options.model });
  </code></pre>
  
  <p>I define a function <strong>updateModel</strong> intended to update the attribute value as:</p>
  
  <pre><code>updateModel: function(){
      var val= $("#textbox_id").val();
  console.log(val);   
  console.log(JSON.stringify(this.options.model));
  JSON.stringify(this.options.model);
  this.options.model.set({"rank": val});
  this.render();
  //
  },
  </code></pre>
  
  <p>Where am I going wrong?
  I can see the value and the model with its previous attribute values in the console.</p>
  
  <p>The model:</p>
  
  <pre><code>define(['jquery','underscore', 'backbone', 'deepmodel'], 
         function($,_, Backbone) {
           var model = Backbone.DeepModel.extend({
  
          // Default attributes for the model.
          defaults : {
              id: null,
                  rank: null,
  
          },
  
          initialize: function(){
              _.bindAll(this,"update");
                      this.bind('change : cost', this.update);
          },
  
          update: function(){
              console.log(this.get("cost"));
  
          },
          // Remove this model from *localStorage*.
          clear : function() {
              this.destroy();
          },
  
      });
      return model;
  </code></pre>
  
  <p>});</p>