title: Rails & Ajax: ActionController::RoutingError (No route matches [POST] "/users/103")
body: <p>I'm getting the following error:</p>
  
  <blockquote>
    <p>ActionController::RoutingError (No route matches [POST] "/users/103")</p>
  </blockquote>
  
  <p>rake routes:</p>
  
  <pre><code>                  PATCH    /users/:id(.:format)                      users#update
                    PUT      /users/:id(.:format)                      users#update
  </code></pre>
  
  <p>My form:</p>
  
  <pre><code> &lt;%= form_for current_user, id: 'photoinfo', html: { multipart: true }, :remote =&gt; true do |f| %&gt;
  
      &lt;%= f.file_field :avatar, accept: 'image/png,image/gif,image/jpeg, image/jpg', id: 'uploadAvatar' %&gt;
  
      &lt;%= f.submit 'Submit Photo', id: 'submitPhoto' %&gt;
  
   &lt;% end %&gt;
  </code></pre>
  
  <p>js:</p>
  
  <pre><code>$.ajax({
          type: "POST",
          url: $('.edit_user').attr('action'), //sumbits it to the given url of the form
          data: result,
          dataType: "JSON" // you want a difference between normal and ajax-calls, and json is standard
      }).success(function(json){
          console.log("success", json);
      });
      return false; // prevents normal behaviour
  </code></pre>
  
  <p>Where am I going wrong? Why is it saying no route matches?</p>