I have a form that submits fine and is processed by the controller but
began failing to return Javascript (around the time I upgraded to 3.0.7)
and instead generates a "406 Not Acceptable."

I've tried everything I can think of to get this working again, and I'm
completely baffled.

I've stripped the problem down to the following:

config/routes:
  match 'my_words/test_create(.:format)' => 'my_words#test_create'

whatever.html.erb:
  <%= form_tag(url_for("/my_words/test_create.js"), :format => :js,
"data-type" => "script", :remote => true) do %>
    <%= submit_tag "Test JS" %>
  <% end %>

app/controllers/my_words_controller.rb:
  # I don't think this is necessary, but I'm trying to isolate the
problem
  authenticate_user! :except => [:test_create]
  ...
  def test_create
    respond_to do |format|
      format.js { render :js => "alert('This much works');" }
    end
  end

>From development.log:

Started POST "/my_words/test_create.js" for 127.0.0.1 at Fri May 13
12:13:01 -0400 2011
  Processing by MyWordsController#test_create as JS
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"xxxxxxx"}
Completed 406 Not Acceptable in 2ms

>From Firebug:

Response Headers
Cache-Control  no-cache
x-ua-compatible  IE=Edge,chrome=1
Set-Cookie  _xxxxxx_session=xxxxxx; path=/; HttpOnly
X-Runtime  0.095000
Content-Type  text/html;charset=utf-8
Content-Length  1
Date  Fri, 13 May 2011 16:13:01 GMT

Request Headers
Host  localhost:3005
User-Agent  Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17)
Gecko/20110422 Ubuntu/10.10 (maverick) Firefox/3.6.17
Accept  text/javascript, application/javascript, */*; q=0.01
Accept-Language  en-us,en;q=0.5
Accept-Encoding  gzip,deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive  115
Connection  keep-alive
Content-Type  application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With  XMLHttpRequest
X-CSRF-Token  xxxxxxxx
Referer  http://localhost:3005/home/article/10671
Content-Length  82
Cookie  socketio=xhr-multipart; xxxxxxx

Any ideas?

Thanks so much!

James

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to