Search code examples
javascriptjqueryruby-on-railsujs

Rails 406 "Not Acceptable" errors with remote forms?


I'm trying to add a remote form to my Rails 3 app with jQuery UJS, and although the form appears to be sending its request correctly, the server returns a 406 "Not Acceptable" error:

Started POST "/account.1" for 127.0.0.1 at 2011-06-30 07:14:27 +0200
Processing by AccountsController#update as 
...
Completed 406 Not Acceptable in 295ms

jQuery-UJS appears to be sending the correct HTTP_ACCEPT header:

text/javascript, application/javascript, application/ecmascript, 
application/x-ecmascript, */*; q=0.01

and I've stripped the accounts#update action to a bare minimum to try to debug this, but nothing's worked:

class AccountsController < ApplicationController

  respond_to :html, :js

  def update
    @account = Account.find(params[:id])

    respond_with(@account) do |format|
      format.html
      format.js
    end
  end

end

For what it's worth, I'm using HTML5 Boilerplate to load the jQuery library via Google API, and I'm using Modernizr to let include Javascript at the bottom of the page instead of in the <head> element.

Has anyone encountered anything like this? What am I doing wrong?


Solution

  • The url seems to be wrong. It should be /update/1 instead of /update.1

    Hope this helps.