Respond_to wrong in ie -- html requests seen as text/javascript

Anyone come across this problem?

It may be something I’m doing somewhere, but my page renders fine in
Firefox, and returns a syntax error in Internet explorer.

Very strange, I thought, then I traced it to the fact that the IE
request is responding to format.js while the firefox request is
responding to format.html:

def index_response respond_to do |format| format.js { puts("was js") if (params[:search] && params[:search][:current]) puts("search current") render :template=>"models/association_page.rjs" else puts("rendering div partial") render :partial=>'div',:collection=>@objects, :locals=>{:pa=>@pa, :parent_object=>@parent_object, :editable=>params[:editable] } end } format.html { puts("was html") if @exact_objects.size == 1 && @objects.empty? @object = @exact_objects.to_a.first redirect_to :action=>'show', :id=>@object.id elsif @exact_objects.empty? && @objects.empty? && logged_in?

redirect_to({:action=>“new”}.merge(search_params_into_params))
end
}
end

for the IE request, it logs:
“was js”
“rendering div partial”.

while the firefox request logs
“was html”

Any ideas what could cause this?

Never mind – I didn’t realize a page could respond to different mime
types, and the Responder would respond to the first one that works, so
I switched the order and that works.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs