title: $resource update method behaving strangely
body: <p>Reading/Creating/Deleting is all working fine for a particular $resource, however Editing is not going so well.</p>
  
  <p>In my app config I have:</p>
  
  <pre><code>$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
  $httpProvider.defaults.headers.put['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
  </code></pre>
  
  <p>This is working fine for both POST/PUT, maybe it's worth mentioning.</p>
  
  <p>My $resource definition looks like:</p>
  
  <pre><code>app.factory('Project', function($resource) {
      return $resource('project/:id',{},{
          query: { method: 'GET', isArray: false },
          update: { method: 'PUT' }
      });
  });
  </code></pre>
  
  <p>Then in ProjectEditCtrl:</p>
  
  <pre><code>var ProjectEditCtrl = function ($scope, $routeParams, Project, $location) {
      var id = $routeParams.id;
      $scope.projectForm = Project.get({id: id});
      $scope.projectDo = function() {
          var params = $.param($scope.projectForm);
          Project.update({id: id}, params);
      }
  }
  </code></pre>
  
  <p>Now when I actually run <code>$scope.projectDo()</code> I get a string of requests, not just the PUT, shown in this screencap:</p>
  
  <p><img src="https://i.stack.imgur.com/W4Jf4.png" alt="enter image description here"></p>
  
  <p>Why are there any other calls other than the <code>PUT project/1</code>? Note that the DELETE 500's are occurring because there's no <code>:id</code> in the the path.</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>Just for fun, I decided to alter the entire $resource definition to the following:</p>
  
  <pre><code>query: { method: 'GET', isArray: false },
  update: { method: 'PUT' },
  save: { method: 'GET' },
  delete: { method: 'GET' },
  get: { method: 'GET' }
  </code></pre>
  
  <p>Testing using this definition confirms that the Add/Delete controllers respect it, and attempt to use GET for <code>Project.delete</code> and <code>Project.save</code>.</p>
  
  <p>Running <code>Project.update</code> now seems to exhibit fewer weird calls. Where as before there was:</p>
  
  <ul>
  <li>POST x1</li>
  <li>GET x2</li>
  <li>DELETE x2</li>
  <li>PUT x2</li>
  </ul>
  
  <p>After forcing all except <code>update()</code> to GET, I now see:</p>
  
  <ul>
  <li><strong>no POST</strong></li>
  <li>GET x2</li>
  <li>DELETE <strong>x1</strong></li>
  <li>PUT x2</li>
  </ul>
  
  <p>Still just as confused, but possibly useful info.</p>
  
  <p><strong>UPDATE 2</strong>:</p>
  
  <p>Decided to try abandoning the PUT method so <code>Project.update()</code> uses POST instead, however a similar problem occurs with lots of undesired requests.</p>
  
  <p>Also note, that all of these requests fire at the same point in time, meaning none of them are sequential or reacting to the completion of another request.</p>
  
  <p><strong>UPDATE 3</strong>:</p>
  
  <p>Tried using a different word other than <code>update</code> to see if I was somehow trampling on existing code, but <code>Project.whaaaat()</code> has the same effect.</p>
  
  <p><strong>UPDATE 4</strong>:</p>
  
  <p>OK getting a bit closer to the truth now. Tried a method that was not defined, and the same behavior occurs. I suppose I'm simply firing every defined method when I call a method that's not recognized?</p>
  
  <p><strong>UPDATE 5</strong>:</p>
  
  <p>Looks like the problem is caused by the combination of these 2 lines:</p>
  
  <pre><code>$scope.projectForm = Project.get({id: id});
  var params = $.param($scope.projectForm);
  </code></pre>
  
  <p>In running <code>$.param</code> on the object returned by <code>Project.get</code> it's calling all <code>Project</code> methods since they are actually properties.</p>
  
  <p>Running a loop over <code>projectForm</code> properties with <code>typeof</code> reveals:</p>
  
  <p>name is a string
  id is a number
  $get is a function
  $save is a function
  $query is a function
  $remove is a function
  $delete is a function
  $update is a function</p>
  
  <p>Is there a way to run $.param on an object and prevent the serialization of un-serializable properties?</p>