title: Rails 3 js.erb is never called
body: <p>I'm trying to keep the user on the same page and execute some Javascript after an Update is performed..</p>
  
  <p>However my js.erb never seems to get called and instead I get redirected to the route "http://localhost:3000/upload_images/id" and my firebug console produces...</p>
  
  <pre><code>"NetworkError: 406 Not Acceptable -http://localhost:3000/upload_images/id"
  </code></pre>
  
  <p>Update Action</p>
  
  <pre><code>    def update  
      @upload_image = UploadImage.find(params[:id])
      #If this image is set as the preview restore all associated images to default
      if params[:upload_image][:preview] == "1"
        other_uploads = @upload_image.upload.upload_images.where("not upload_images.id = ?", @upload_image.id)
        other_uploads.each do |upload_image|
          upload_image.preview = "0"
          upload_image.save
        end
      end      
      respond_to do |format|    
        if @upload_image.update_attributes(params[:upload_image])
          #keep the user on current page and call some Javascript
          format.js{render :template =&gt; 'update.js.erb'}
        else
          format.html { render action: "edit" }
          format.json { render json: @upload_image.errors, status: :unprocessable_entity }
          format.js
        end
      end
    end
  </code></pre>
  
  <p>Update.js.erb</p>
  
  <pre><code>alert("hello world!");
  </code></pre>
  
  <p>Edit form</p>
  
  <pre><code>&lt;%=form_for(@upload_image) do |f| %&gt;
     ....
  &lt;% end %&gt;
  </code></pre>
  
  <p>It's not important for me to see the live updates, I don't mind if the user has to refresh to see them. I just want to keep the page state as is (with the exception of some changes made by JQuery) and make a post to the database.</p>