Ruby on Rails Wednesday, January 4, 2012

Hi,


I have a legacy web site based on ruby on rails 3.0.9 which works just fine with Firefox, chrome and IE 8, but I receive an HTTP 406 error every time when I check the web site with Internet Explorer 9. I narrowed down the problem to the respond_to + format.js + render :update trio, but I did not manage to solve the problem until now.

I created a small example for reproduction:

The action from the controller:

  def change
    if params[:kind]
      respond_to do |format|
        format.js do
          render :update do |page|
            # originally we have a much more complicated logic here
            # ...
            page.replace_html 'list_of_numbers', :partial => params[:kind]
            # we even have this:
            # page << "changePrefix();"
          end
        end
      end
    end
  end

The view:

<%= link_to("odd", url_for(:controller => "main", :action => "change", :kind => "odd"), :remote => true) %>
<%= link_to("even", url_for(:controller => "main", :action => "change", :kind => "even"), :remote => true) %>
<div id="list_of_numbers"><%= render :partial => "odd" %><div>

On the server side I see this:

Started GET "/change?kind=odd" for 10.0.8.9 at Wed Jan 04 11:10:59 +0100 2012 Processing by MainController#change as HTML Parameters: {"kind"=>"odd"} Completed 406 Not Acceptable in 0ms

And the IE 9 says quite the same.

Any ideas why this doesn't work with IE9?

Thank you in advance!

Sincerely,
Zsolt

--

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment